# Int x[] = { 1, 4, 8, 5, 1, 4 };int *ptr, y;ptr = x + 4;y = ptr - x;What does y in the sample code above equal?A. -3B. 0C. 4D. 4 + sizeof( int )

Showing Answers 1 - 5 of 5 Answers

#### Vijaya Bhaskar M

• Jul 24th, 2005

The correct choice is D . since in the program it is dealing only with the address not with the values present at the address. so it will add the 4 to the size of interger.

Was this answer useful?  Yes

#### Guest

• Oct 17th, 2006

The correct answer is 'C' ...... As the value of ptr-x will always be in terms of "how many integer fields the two pointer differ".....
Moreover, answer can never be 'D', as it says 4 + sizeof(int), while the actual address should be 4*sizeof(int)...

#### manoj

• Nov 11th, 2006

answer is -3

Was this answer useful?  Yes

#### Thanom

• Nov 26th, 2006

int x, *ptr;
*ptr = &x;

Was this answer useful?  Yes

#### anu1985 Profile Answers by anu1985

• Jun 9th, 2008

ptr=&x[5]
ptr=(x+4)
y=(x+4)-(x+0);
y=4

Was this answer useful?  Yes

### Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

### Answer Question

Click here to Login / Register your free account

Send   Reset