The problem is that the shell expands *to all file names (which do not start with .) in the current directory. It's all about the shell and has very little to do with C.
The value argcincludes 1 for the program's own name, plus one for each argument passed by the shell.
Try:
filename *
filename '*'
The first will give you 623 (give or take - but it's time you cleared this directory!). The second will give you 2.
source
share