string holding text every \n

Posted by gcc on Stack Overflow See other posts from Stack Overflow or by gcc
Published on 2010-04-28T10:20:45Z Indexed on 2010/04/28 10:33 UTC
Read the original article Hit count: 171

Filed under:
|

I tried to take input in form of string, specifically:

int i=0;
char c[50][500];
 for(;i<50;++i)
   scanf("%s",A[i]);

The input is

x  is a website that allows the easy[1] creation and editing of any number of interlinked 
 web pages via a web browser using a simplified markup language or a WYSIWYG text editor.

In my program, I want the text to be stored as:

A[0]="x  is a website that allows the easy[1] creation and editing of any number of interlinked"
A[1]=" web pages via a web browser using a simplified markup language or a WYSIWYG text editor."

But my code causes the text to be stored as

A[0]="is"
A[1]="a"
A[2]="website" 
....

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about c

    Related posts about scanf