Unsigned char c;
for ( c=0;c!=256;c++2)
printf("%d",c);
No. of times the loop is executed ?
Answer Posted / manishsoni
It produce compile time error becoz the statement c++2 is
not allowed here.
if this statement is written as c+=2,then it will give us an
infinite loop between
0--->254----->0---->254...
because it check simply c!=256(mean c is not equal to
256,mean it simply it didnot print the value at 256,that
mean it did not print 256...after 254...and print 0)
------------------------------------------------------------
No. of times the loop is executed ?
------------------------------------------------------------
loop will execute 128 times becoz:
the loop is increased each time by 2 and loop is execute
254 time without zero so
254/2=127
127+1(zero)=128;
so the loop is execute 128 times....
BY:ManisH SonI(MoNu)
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is c language and why we use it?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
What is a structure member in c?
What are the features of c language?
What is default value of global variable in c?
What is a stream water?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
How do you list files in a directory?
Explain 'bus error'?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
What are the two types of functions in c?
Stimulate calculator using Switch-case-default statement for two numbers
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
What is the use of bit field?
How can a program be made to print the name of a source file where an error occurs?