1) int main() {
unsigned char a = 0;
do {
printf("%d=%c\n",a,a);
a++;
}while(a!=0);
return 0;
}
can anyone please explain the explain the output

Answer Posted / c.p.senthil

ANS: Prints all the ascii characters from 0 to 255 in the below format
0=
1=☺
2=☻
3=♥
4=♦
5=♣
6=♠
.
.
.
251=√
252=ⁿ
253=²
254=■
255= 

'a' is a unsigned char variable, size = 8 bits
so the maximum value 'a' can store is 255.
an increment from 'a' value 255 will cause overflow and
'a' value becomes 0, when the loop terminates.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you use a 'Local Block'?

714


Explain what are reserved words?

630


Explain why c is faster than c++?

566


Explain what are preprocessor directives?

621


Explain what would happen to x in this expression: x += 15; (assuming the value of x is 5)

805






Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3116


Why does notstrcat(string, "!");Work?

637


What are the types of macro formats?

598


What is pass by value in c?

592


Explain how can I make sure that my program is the only one accessing a file?

616


What language is windows 1.0 written?

571


Why we use conio h in c?

580


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

652


What does the c in ctime mean?

561


I need previous papers of CSC.......plz help out by posting them.......

1810