#include <stdio.h>
#include <limits.h>
int main() {
enum loop {NO ,YES};
enum loop okloop = YES;
int i=0;
char s[8];
int lim=6;
char c;
while (okloop==YES)
{
if (i>=lim-1)
okloop=NO;
else if ((c=getchar())!='\n')
okloop=NO;
else if (c==EOF)
okloop=NO;
else {
s[i]=c;
++i;
}
}
for (i=0;i<5;++i)
printf("this is the character %c\n",s[i]);
return 0;
}
I am just inputing a character from the keyboard and stored it in an array; and then I have to print the character stored in the array to screen, but the output is not as I have expected.