scanf - C fscanf formatting -
I am quite new to C and I have trouble in these pieces of code:
When I try to compile I get a warning: / P>
format '% s' is the argument type * four *, but argument of type 3 is char (*) [80].
Now it is remedied using the and the word [0]
. Now, to find out at the beginning of the array, these two points should not be shown?
When you use , in the format
Fscanf
, it is assumed that the argument is a char *
, which can catch the characters read from the stream. This tells the warning message.
In your case, the numeric value is the same as and the word
and the word [0]
. However, this is not true at all times, for example, if you have:
four * words = molk (20);
Then, the numeric value & amp; The term
that & amp; The term [0] is not equal to
Compiler is not taking responsibility for dealing with such distinctions. It's just looking for a four *
argument.
Comments
Post a Comment