Answer:
#include <stdio.h> 
#include <stdlib.h> 
int main() { 
 int n, i, *p, s; 
 scanf("%d", n);
 p = (int*) malloc(n * sizeof(int)); 
 if(p == NULL) { 
 printf("\\Error! memory not allocated."); 
 exit(0); 
 } 
 printf("\\Enter elements of array : "); 
 for(i = 0; i < n; ++i) { 
 scanf("%d", p + i); 
 } 
 scanf("Enter Id to be searched: %d", s);
 for(j = 0; j < n; ++j) { 
 if (s == *(p+j)){
 printf("ID number is in the array at position %d", j);
 }else{
 printf("Error: ID number does not exist.");
 } 
 } 
 return 0;
Step-by-step explanation:
The C program source code inputs integer values to dynamic array size, and the search variable is looked for in the array using a for loop. If the search term exists, then the index position is printed on the screen, else an error message is displayed on the screen.