Alice Yuan
PRO
yesterday
Alicecountry asked

What is a command line argument?

Abhay Jajodia
Expert
yesterday
Abhay Jajodia answered

Hi Alice 😊

A command line argument is a value you pass to a program when you run it from the terminal. These values tell the program what data it should work with or what action it should perform.

For example, if you have a program that adds numbers, you can run it like this:

./add 10 20

Here, 10 and 20 are the command line arguments. The program reads these values and uses them to calculate the result.

I hope this explains the concept clearly 😊 Please let me know if you need any further help.

C
This question was asked as part of the Learn C Programming course.