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
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.
What is c++ mutable?
How much do c++ programmers make?
Ask to write virtual base class code?
What is c++ stringstream?
What is a catch statement?
How will you call C functions from C ++ and vice-versa?
What is public, protected, private in c++?
What is auto used for in c++?
When one must use recursion function? Mention what happens when recursion functions are declared inline?
What is c++ iterator?
Is c the same as c++?
How do you establish an is-a relationship?
How do you traverse a btree in backward in-order?
Name the debugging methods that are used to solve problems?