int main(){
int a[]={1,2,3,5,1};
int *ptr=a+4;
int y=ptr-a;

Answers were Sorted based on User's Feedback

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
i.e., y=4

Is This Answer Correct ?    1 Yes 0 No

Answer / anunithi


Is This Answer Correct ?    3 Yes 3 No

Answer / sridhar


Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

main() { printf(5+"Vidyarthi Computers"); }

6 Answers  

Is it possible to run using programming C for Java Application?

2 Answers   NIC,

how can i get output like this? 1 2 3 4 5 6

6 Answers   Excel,

How to reverse alternate words in a given line of string For Eg: my name is narasimha output : my eman is ahmisaran

0 Answers  

How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?

1 Answers  

how to find greatet of 10 numbers without using array?

4 Answers  

what is the difference between declaration ,defenetion and initialization of a variable?

7 Answers   LG Soft,


2 Answers   Wipro,

how to exchnage bits in a byte b7<-->b0 b6<-->b1 b5<-->b2 b4<-->b3 please mail me the code if any one know to rajeshmb4u@gmail.com

3 Answers   Honeywell, Huawei,

how can we use static and extern?and where can we use this?

3 Answers   Excel,

Give the Output : * * * * * * * * * *

2 Answers  

what would be the output of the follwing struct st { char name[20]; int i; float f; }; main() { struct st emp = {"forum"}; printf("%d %f",emp.i,emp.f); }

4 Answers