'How does argc in C works?

int argcin C is an integer variable that holds the number of arguments that are passed to the program through the command line . Since we don't pass any integer to the command line while executing the program , then which component is responsible for passing the number of arguments to argc variable ?



Solution 1:[1]

The "command line" is input to a shell program. It is that program that parses the line and forms argc and the NULL terminated array for argv and then calls the C program.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1