0
Where arguments are written in c++ pogram
4 odpowiedzi
+ 1
Arguments are function parameters. They are put between parenthesis right after the function name. For example:
int square(int n) {
return n*n;
}
Here the function square takes one integer argument that it names n. When calling square(42), I pass 42 to the function as parameter.
If you meant to ask how to use parameters for the program itself, use the int main(int argc, char* argv[]) prototype, where argc is the number of arguments (including the program itself as first parameter) and argv an array of arguments. Here is an example:
int main(int argc, char* argv[]) {
int i;
for (i = 0; i < argc; i++) {
cout << argv[i] << endl;
}
}
0
You Can Use Arguments In Writing Function.
Example : int add(int a ,int b);
Here The int a and int b are The Arguments.
0
ty Piyush Kumar
0
Arguments are used on defining and calling the functions