I have this code that is not working and I don't understand what I am missing!
Here is the code:
Code:
/* */
2 #include <stdio.h>
3 #define MAX 255
4 int main(void)
5 {
6 int i;
7 char line[MAX]={0};
8 printf("Please enter a line of text:\n");
9 for(i=0;scanf(" %c",&line[i])!='\n';i++);
10
11 printf("Now we are out of the loop!\nvalues on the array:\n");
12 for(i=0;i!='\0';i++)
13 printf("%c",line[i]);
14 printf("Bye!!!\n");
15
16 return 0;
17 }
I enter 1 or more new lines and the program doesn't get out off of the for cicle!
I know something is wrong but I don't know what. And I am on this for about 2 days... If somebody could help me I would be glad!
Hugs