#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

Give a fast way to multiply a number by 7

15 Answers   Accenture, Aricent, Microsoft,


how to find greatet of 10 numbers without using array?

4 Answers  


Explain what is gets() function?

0 Answers  


What is structure and union in c?

0 Answers  


Expand the following LKB BKL FFG

0 Answers  






Who is the main contributor in designing the c language after dennis ritchie?

0 Answers  


Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.

7 Answers   Accenture, Gridco, IBM, Kevin IT, TCS, Vimukti Technologies,


what is the benefit of c30

2 Answers  


What is typedef?

1 Answers  


How many types of linked lists what are they? How many types of data structures?

18 Answers   BSNL, Pivotal Software,


please send me papers for Dy. manager IT , PNB. it would be a great help for me.

0 Answers  


write a program in c language for the multiplication of two matrices using pointers?

8 Answers   Ignou,


Categories