In the following C code:
printf( "Coffee!" );
and
scanf("%d", &coffee);
printf("\nI’m baking %d coffee!", coffee);
Are "Coffee!"
and coffee
considered arguments?
In the following C code:
printf( "Coffee!" );
and
scanf("%d", &coffee);
printf("\nI’m baking %d coffee!", coffee);
Are "Coffee!"
and coffee
considered arguments?
You have provided one argument to the first call to printf()
, and you have provided two arguments to the call to scanf()
and two more to the second call to printf()
.
The C standard defines both 'argument' and 'parameter':
"Are "Coffee!" and coffee considered Arguments?"
EDITED (in response to corrected original post by Jonathan L.)
Yes, they are both arguments.
printf()
, "Coffee!"
is a single string literal argument.printf()
: coffee
is the 2nd argument, an int
value.scanf()
statement as the location to be changed, or in short the address of coffee
(&coffee
)Of course this all assumes that coffee
was defined similar to;
int coffee = 0;
Note on arguments and parameters... (mentioned in comments under question)
When a function is called, the values that are passed during the call are referred to as arguments. The values which are used to define the type of argument used in a function prototype are referred to as parameters. (reference)