#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 ?    2 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 ?    3 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 0 No



Post New Answer



More C Interview Questions

1. Write a program to reverse every second word in a given sentence.

1 Answers  


helllo sir , what is the main use of the pointer ,array ,and the structure with the example of a programe

2 Answers  


wap in c to accept n number display the highest and lowest value

2 Answers  


#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300,200,100

1 Answers  


what is a NULL pointer?

2 Answers  






What is the output of the program given below #include<stdio.h> main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

21 Answers   TCS, ADITI, Student,


to find the closest pair

0 Answers   Infosys,


what is the use of a array in c

6 Answers  


what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }

3 Answers   Honeywell,


Find the largest number from the given 2 numbers without using any loops and the conditional operator.

2 Answers  


what is the defrenece between structure and union

5 Answers   Aloha Technology,


What is the Lvalue and Rvalue?

2 Answers  






Categories