#include<stdio.h>
int main(){
int a[]={1,2,3,5,1};
int *ptr=a+4;
int y=ptr-a;
printf("%d",y);
}

Answers were Sorted based on User's Feedback



#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf(&q..

Answer / harsha

as per my knowledge..4
a is base address of array
every array is a pointer
difference between the pointers is count of data elements ,but not difference between address
y=a+4-a
i.e., y=4

Is This Answer Correct ?    5 Yes 0 No

#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf(&q..

Answer / anunithi

4

Is This Answer Correct ?    6 Yes 3 No

#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf(&q..

Answer / sridhar

1

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

main() { char p[] = "hello world!"; p = "vector"; printf("%s",p); }

2 Answers   Vector, Vector India,


Is a pointer a kind of array?

0 Answers  


True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type

7 Answers  


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

0 Answers  


Does c have an equivalent to pascals with statement?

0 Answers  






Explain 'far' and 'near' pointers in c.

0 Answers  


Can you return null in c?

0 Answers  


WAP to accept rollno,course name & marks of a student & display grade if total marks is above 200?

4 Answers  


Fifty minutes ago if it was four times as many mints past 3 o clock. how many minutes is it to six o'clock n how....?????

3 Answers   TCS,


Explain what is the benefit of using enum to declare a constant?

0 Answers  


How can a number be converted to a string?

1 Answers  


which of the function operator cannot be over loaded a) <= b)?: c)== d)*

10 Answers   Cisco, CTS, Google, HCL, HP,


Categories