Can we specify variable field width in a scanf() format string?

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.

Out of fgets() and gets() which function is safe to use and why?
The function fgets() function is safer to use. It checks the bounds, i.e., the size of the buffer and does not cause overflow on the stack to occur......
Difference between strdup() and strcpy()
The function strcpy() will not allocate the memory space to copy. A pointer to the string to copy and a pointer to place to copy it to should be given.....
What is the difference between char *a and char a[]?
For char[] array, such size is not accepted by the compiler. If the size is specified, the following are the differences between char *a and char a[]......
Post your comment