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

Why is standard template library used?

0 Answers  


How would perform Pattern Matching in C++?

0 Answers   Genpact,


What is the extension of c++?

0 Answers  


What programming language should I learn first?

0 Answers  


Difference between Top down and bottom up approaches for a given project ?

14 Answers   BSNL, CSC, HCL, HP, IIT, Infosys, Siemens,


what Is DCS ? what i will get benefit when i did?

0 Answers  


Can class objects be passed as function arguments?

0 Answers   HCL,


What is the difference between C and CPP?

0 Answers   iNautix,


Which bitwise operator is used to check whether a particular bit is on or off?

0 Answers  


To what does “event-driven” refer?

0 Answers  


Do we have to use initialization list in spite of the assignment in constructors?

0 Answers  


What is vector string in c++?

0 Answers  


Categories