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

write a program that takes two numbers from user that prints the smallest number

2 Answers  


What character terminates all character array strings a) b) . c) END

0 Answers  


write a program that will produce the ff. output. "what fruit will you buy? 1)apple 2)orange 3)mango ENTER CHOICE (1,2 or 3)> HOW MANY WILL YOU BUY?> THAT WILL COST XX.XX

1 Answers  


What are the extraction and insertion operators in c++? Explain with examples.

0 Answers  


How the V-Table mechanism works?

6 Answers   HP,






Do you know what are static and dynamic type checking?

0 Answers  


Can we declare a base-class destructor as virtual?

0 Answers  


What is a class definition?

0 Answers  


What are the four main data types?

0 Answers  


What is the difference between public, private, and protected access?

0 Answers  


A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.

0 Answers  


What is atoi?

0 Answers  


Categories