2

Possible Duplicate:
What does int argc, char *argv[] mean?

int main (int ac, char **av)
{
  /* functions*/
}

What are meant by ac and av here?

Community
  • 1
  • 1
stefideltz
  • 15
  • 1
  • 2

3 Answers3

9

ac is **argument count.

av should be char **av and it's an array of string pointers containing command line arguments.

So, if you invoke your program like this:

$ ./prog 1 2 3

ac will have a value of 4 and av will be something like:

av[0] -> "prog"
av[1] -> "1"
av[2] -> "2"
av[3] -> "3"
Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292
3

ac is a number of parameters passed to the program.

char ** av is an array of arguments.

Vladimir Ivanov
  • 42,730
  • 18
  • 77
  • 103
1

attribute count and attribute value

Nikolaus Gradwohl
  • 19,708
  • 3
  • 45
  • 61