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 are pointers?
What is %d used for?
develop algorithms to add polynomials (i) in one variable
What is the significance of scope resolution operator?
Explain the difference between the local variable and global variable in c?
Why doesnt the call scanf work?
What is console in c language?
Write a C program linear.c that creates a sequence of
processes with a given length. By
sequence it is meant that each created process has exactly
one child.
Let's look at some example outputs for the program.
Here the entire process sequence consists of process 18181:
Sara@dell:~/OSSS$ ./linear 1
Creating process sequence of length 1.
18181 begins the sequence.
An example for a sequence of length three:
Sara@dell:~/OSSS$ ./linear 3
Creating process sequence of length 3.
18233 begins the sequence.
18234 is child of 18233
18235 is child of 18234
........ this is coad .... BUt i could not compleate it .....:(
#include
In C language what is a 'dangling pointer'?
What is an auto keyword in c?
How can I find out if there are characters available for reading?
Explain about the functions strcat() and strcmp()?
What is a stream water?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
What is the Purpose of 'extern' keyword in a function declaration?