Can we specify variable field width in a scanf() format string? If possible how?
- It is possible to specify variable field width in a scanf() format string by using %s control string.
- The %s reads a string of variable field width up to the first white space character.Example:
scanf("%s", name); // where name is a character array
- The scanf() stores the results away in variables which you provide in the argument list and reads the data from the console or from a FILE stream and parses it.