scanf - C fscanf formatting -


I am quite new to C and I have trouble in these pieces of code:

Four Words [STRING_LEN]; While (num_words & lt; ARRAY_SIZE & amp; amp; amp; 1 == fscanf (infile, "% 79s", & amp; शब्द))

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

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -