how to get space character from user input

how to get space character from user input

How to get input with spaces in C language?

/*
Example: read string separated by space char in C language
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {

	char str[100];
	scanf("%[^\n]%*c", str);

	printf("%s",str);
	return 0;
}
‮uoS‬rce:www.lautturi.com

example of output:

hello lautturi 《-- user input
hello lautturi
Process returned 0 (0x0)   execution time : 6.886 s
Press any key to continue
Created Time:2017-08-29 08:23:49  Author:lautturi