Tuesday, July 14, 2009

Why my character not print in c lanuguage?I provide it in detail..?

void main()


{


int i;


char ch;


scanf("%d",%26amp;i);


scanf("%c",%26amp;ch);


printf("%d%c ",i,ch);


}

Why my character not print in c lanuguage?I provide it in detail..?
You've got both scanf commands right after each other. So, if you enter the value of 1A it'll print out 1A. If you enter 1 and press enter, it'll print the 1 and then the carriage return character.





To see this for sure, change your printf to look like the following:





printf("[%d][%c]\n ",i,ch);


No comments:

Post a Comment