How to receive strings with spaces in scanf()

Answer Posted / suman halder

#include<stdio.h>
int main()
{
char str[100];
scanf("%[^\n]s",str);

}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the usage of pointer in c?

708


How can you tell whether two strings are the same?

836


Differentiate between null and void pointers.

636


How to get string length of given string in c?

611


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

602






how to introdu5ce my self in serco

1528


Is multithreading possible in c?

573


Do character constants represent numerical values?

848


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

652


Explain modulus operator.

601


What is meant by realloc()?

682


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2010


What is %g in c?

629


Tell me when would you use a pointer to a function?

613


What is assignment operator?

630