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 / anunithi


Is This Answer Correct ?    3 Yes 3 No

Answer / sridhar


Is This Answer Correct ?    0 Yes 0 No

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 ?    0 Yes 0 No

Post New Answer

More C Interview Questions

if the address of a[1,1] and a[2,1] are 1000 and 1010 respectively and each occupies 2 bytes then the array has been stored in what order?

3 Answers  

How to access or modify the const variable in c ?

16 Answers   HP, HCL,

differnce between do and do while

3 Answers   DOEACC,

why programs in c are running with out #include<stdio.h>? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

0 Answers  

what is the output of the below code? main( ) { printf ( "\nOnly stupids use C?" ) ; display( ) ; } display( ) { printf ( "\nFools too use C!" ) ; main( ) ; }

3 Answers  

How to print all the 26 alphabets in this order in C. AbCdEfGh..... it should print dynamically from a to z and do not print this using pgm like this print("Ab......"); Use loops or anything to print all alphabets

2 Answers   Hexaware,

how to impliment 2 or more stacks in a single dimensional array ?

1 Answers   Microsoft, iFlex,

hat is a pointer?

4 Answers   Assurgent,

what is the different between if-else and switch statment (other than syntax)

26 Answers   Oracle, CTS, Scorpos,

Toggle nth bit in a given integer - num

5 Answers   Qualcomm,

about c language

0 Answers  

what is the coding of display the factorial of a number using array and function?

1 Answers