If you had the following code: int x = 23; int *y; y = &x;
The instruction y++; does what?

Answer Posted / naresh kumar

here Y is integer pointer which is storing address of x.
suppose we assume address of X is 65524. this value will stored in pointer variable Y. int variable is capable of storing 2 bytes of memory. If increment or decrement variable Y, It points to next memory location, i.e 65526.

that means y=65524
y++
65526
y++
65528
this will keep on increasing by 2 bytes.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.

610


What is c++ mutable?

705


How much do c++ programmers make?

566


Ask to write virtual base class code?

2149


What is c++ stringstream?

608






What is a catch statement?

587


How will you call C functions from C ++ and vice-versa?

661


What is public, protected, private in c++?

657


What is auto used for in c++?

569


When one must use recursion function? Mention what happens when recursion functions are declared inline?

651


What is c++ iterator?

647


Is c the same as c++?

566


How do you establish an is-a relationship?

622


How do you traverse a btree in backward in-order?

624


Name the debugging methods that are used to solve problems?

581