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 language is lisp written in?
Is it possible to execute code even after the program exits the main() function?
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
What is page thrashing?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What is the use of header files?
explain what is a newline escape sequence?
Why is c faster?
Why we write conio h in c?
What is a macro in c preprocessor?
Explain what is the difference between text files and binary files?
How can you draw circles in C?
Write the syntax and purpose of a switch statement in C.
What are the advantages and disadvantages of a heap?
Explain what is the concatenation operator?