Search code examples
ccmdargvargc

argc and argv aren't running


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);

   }

Solution

  • It should be:

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