how to take blank space in c scanf 1

how to take blank space in c scanf

 scanf("%[^\n]s",str);

Here is what the above code is Doing:
1. The first line is a comment.
2. The second line is a preprocessor directive. It tells the compiler to include the contents of the stdio.h header file in the program before compilation.
3. The third line is a function declaration. It tells the compiler that the function main returns an integer value and takes no arguments.
4. The fourth line is the beginning of the main function.
5. The fifth line is a declaration statement. It declares a variable called str of type char.
6. The sixth line is a function call. It calls the function scanf and passes it the format specifier %[^\n]s and the address of the variable str.
7. The seventh line is the end of the main function.

Similar Posts