driedupsharpie driedupsharpie - 3 months ago 6x
Bash Question

Finding the Number of Elements in an Array of Command Line Arguments?

I'm working off of a Linux command line with g++ and the code will be executed like so:

./mycode arg1 arg2 arg3 ...

This works fine as I am using the array
and the following for main:

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

However there is a part of my program where I need to know the number of command line arguments given.
is failing me here. Any ideas of how this could be accomplished?


This is what the argc stands for