what is the purpose of the code, and is there any problem
with it.

unsigned int v[10];
unsigned int i = 0;
while (i < 10)
v[i] = i++;

Answer Posted / arka bandyopadhyay

Basically it's a tricky question and the values of v[i] cannot be predicted as there is "i++" which means 'use than change'
that is error associated with the program so using ++i will give us the correct result.

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain b+ tree?

629


Can include files be nested?

629


Explain about the functions strcat() and strcmp()?

598


How do you initialize pointer variables?

614


console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above

657






What is a dynamic array in c?

598


What are structure types in C?

671


Explain what is output redirection?

669


What is the difference between break and continue?

606


Can a variable be both constant and volatile?

563


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

734


What is the difference between pure virtual function and virtual function?

653


Is c is a low level language?

566


What is masking?

638


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2000