Language: C


int main(){

  int i,x,n,count = 0;
  int *m;

  scanf("%d",&n);
  m = malloc(sizeof(int) * n);
  for(i = 0 ; i < n ; i++)
    {
      scanf("%d",&m[i]);
      if( isprime(m[i]) == 1)
        {
          count++;
        }
    }
  printf("%d\n",count);
  free(m);
  return 0;
}

int isprime(x){

if( x == 2) return 1;
if( x  < 2 || x % 2 == 0) return 0;
while ( i <= sqrt(x) )
    {
      if(x % i == 0) return 0;
      i = i +2;
    }

return 1;
}

Compiler output:
main.c: In function 'main':
main.c:7:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    7 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | 
main.c:7:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 |   scanf("%d",&n);
      |   ^~~~~
main.c:7:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:8:7: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
    8 |   m = malloc(sizeof(int) * n);
      |       ^~~~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | 
main.c:8:7: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
    8 |   m = malloc(sizeof(int) * n);
      |       ^~~~~~
main.c:8:7: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:12:11: error: implicit declaration of function 'isprime' [-Wimplicit-function-declaration]
   12 |       if( isprime(m[i]) == 1)
      |           ^~~~~~~
main.c:17:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |   printf("%d\n",count);
      |   ^~~~~~
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:3: error: implicit declaration of function 'free' [-Wimplicit-function-declaration]
   18 |   free(m);
      |   ^~~~
main.c:18:3: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c:18:3: warning: incompatible implicit declaration of built-in function 'free' [-Wbuiltin-declaration-mismatch]
main.c:18:3: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c: In function 'isprime':
main.c:22:5: error: type of 'x' defaults to 'int' [-Wimplicit-int]
   22 | int isprime(x){
      |     ^~~~~~~
main.c:26:9: error: 'i' undeclared (first use in this function)
   26 | while ( i <= sqrt(x) )
      |         ^
main.c:26:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:14: error: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
   26 | while ( i <= sqrt(x) )
      |              ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt'
  +++ |+#include <math.h>
    1 | 
main.c:26:14: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
   26 | while ( i <= sqrt(x) )
      |              ^~~~
main.c:26:14: note: include '<math.h>' or provide a declaration of 'sqrt'