argc and argv aren't running

Sahir picture Sahir · Nov 27, 2013 · Viewed 11.5k times · Source

Here is what the geany says. Help appreciated.

rec_pattern_printing.c:5: error: syntax error before '*' token

rec_pattern_printing.c: In function `main':

rec_pattern_printing.c:8: error: `argc' undeclared (first use in this function)

rec_pattern_printing.c:8: error: (Each undeclared identifier is reported only once

rec_pattern_printing.c:8: error: for each function it appears in.)

rec_pattern_printing.c:13: warning: implicit declaration of function `atoi'

rec_pattern_printing.c:13: error: `argv' undeclared (first use in this function)

Compilation failed.

   #include<stdio.h>
   int main(int argc, *char argv[] )
   { int N;

   if(argc<2)
   printf("Not enough arguments to continue");
   getche();
   return 4;

   N = atoi(argv[1]);
   printf("%d",N);

   }

Answer

Andriy Tylychko picture Andriy Tylychko · Nov 27, 2013

It should be:

int main(int argc, char* argv[] )