/*****memory_leak.c - This program has a subtle***** ********** error due to a "memory leak ************/ #include #define NUM_ELEMENTS 100 main(void) { int i, key; int arr[NUM_ELEMENTS]; puts("Please enter the key to be searched for"); scanf("%d",&key); for(i=0;i <= NUM_ELEMENTS;i++) /* the error is here */ arr[i] = 300 + i; i=0; while (i < NUM_ELEMENTS ) { if (arr[i] == key) { printf("The key is found in position %d.\n",i); break; } else i++; } if (i == NUM_ELEMENTS) printf("The key %d is not in the array.\n",key); }