![]() |
Help with a program
Code:
#include<stdio.h>errors :- 1. There is no compile error. 2. the second scanf(); function does not inputs. 3. No printf funtion occurs. help me run this program successfully. thanks in advance. |
Re: Help with a program
The problem happen by the '\n' of the line.Since it gets the input till the newline the entered '\n' will remain in the buffer .
That '\n' will come as a input for the line2.It too get the input till the '\n' . So it comes out immediately . So you need to clear the '\n'.You can do this by getchar(). Code:
#include<stdio.h>Code:
scanf("%[^\n]",line2); |
| All times are GMT +5.5. The time now is 23:01. |