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

Answers were Sorted based on User's Feedback



1) int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); ..

Answer / 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

1) int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); ..

Answer / vidyashree b l

0

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

Explain the advantages of using macro in c language?

0 Answers  


What are pointers? What are different types of pointers?

0 Answers   Fidelity,


What is maximum size of array in c?

0 Answers  


What is time complexity c?

0 Answers  


What are the restrictions of a modulus operator?

0 Answers  






how to reverse string "Hello World" by using pointers only. Without any temp var

1 Answers  


what will be the output of "printf("%d%d",scanf("%d% d",&a,&b))".provide an explation regarding the question

6 Answers  


What is graph in c?

0 Answers  


What are the loops in c?

0 Answers  


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

0 Answers  


void main() { //char ch; unsigned char ch; clrscr(); for(ch =0;ch<= 127; ch++) printf(" %c= %d \t ", ch, ch); } output?

4 Answers   Groupon,


What are multidimensional arrays?

0 Answers  


Categories