P
prassu
This is prasad. I started learning C just now. Thats why my Questions
may be silly . please don`t mind and help me to learn C in a good way.
i tried the following in Vi editor..
My questions are
main()
{
char a;
printf("enter the char\n");
scanf("%c",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
prasad is 2
no doubt for the above
main()
{
char a;
printf("enter the char\n");
scanf(" %c",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
prasad is 2
if we give space(s) before %c it is printing as in first case why?
main()
{
char a;
printf("enter the char\n");
scanf("%c ",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
if we give space(s) after %c it is not printing any thing , to come out
of that program we have to press ctrl+z
why?
main()
{
char a;
printf("enter the char\n");
scanf("% c",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
prasad is
if we give a space between % and c it is printing as above why?
thanking you in advance
bye....
may be silly . please don`t mind and help me to learn C in a good way.
i tried the following in Vi editor..
My questions are
main()
{
char a;
printf("enter the char\n");
scanf("%c",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
prasad is 2
no doubt for the above
main()
{
char a;
printf("enter the char\n");
scanf(" %c",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
prasad is 2
if we give space(s) before %c it is printing as in first case why?
main()
{
char a;
printf("enter the char\n");
scanf("%c ",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
if we give space(s) after %c it is not printing any thing , to come out
of that program we have to press ctrl+z
why?
main()
{
char a;
printf("enter the char\n");
scanf("% c",&a);
printf("prasad is %c\n",a);
}
o/p : enter the char
2
prasad is
if we give a space between % and c it is printing as above why?
thanking you in advance
bye....