C11.3 |sum of all arguments passed from command prompt | C Language| for Beginners| Dr Khaja Masthan

Опубликовано: 06 Сентябрь 2026
на канале: Soft Trainers
60
1

sum of two Numbers--   • C11.2| Sum of two numbers given in Command...  
The arguments passed from command line are called command line arguments. These arguments are handled by main() function.

To support command line argument, you need to change the structure of main() function as given below.

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

Here, argc counts the number of arguments. It counts the file name as the first argument.

The argv[] contains the total number of arguments. The first argument is the file name always.