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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / anu

Then y will point to next memory location.
If we are using (*y)++ will increment value to 24.

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More C++ General Interview Questions

How can you link a c program with a c function?

0 Answers  


What is isdigit c++?

0 Answers  


Differentiate between structure and class in c++.

0 Answers  


Explain the uses of static class data?

0 Answers  


Is c++ an integer?

0 Answers  






Why is it difficult to store linked list in an array?

6 Answers   Infosys, Lucent,


What is c++ 11 and c++ 14?

0 Answers  


Please post the model question paper of hal?

2 Answers  


Write a program to reverse a linked list?

8 Answers   Catalytic Software, Satyam,


Is c++ used anymore?

0 Answers  


Is c++ vector a linked list?

0 Answers  


total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.

0 Answers  


Categories