![]() |
In C, we can provide arguments to a program while running it from the command line interface. These arguments are called command-line arguments. In this article, we will learn how to write a command line program in C. How to Write a Command Line Program in C?Command line arguments are passed to the main() function. For that purpose, the main function should have the following signature: int main( int argc , char *argv[] ){ // Write your code } Here, argc is the number of arguments, and argv[] is the argument in the form of an array of strings.
C Program to Pass Command Line ArgumentsC
Command Line Instruction // assume that the file name is solution ./solution 10 20 30 40 50 Output SUM of 5 numbers is: 150
To know more, refer to the article – Command Line Arguments in C |
Reffered: https://www.geeksforgeeks.org
C Language |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 11 |