#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
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 |
What is the purpose of 'register' keyword?
What is the need of structure in c?
find the size of structure without using the size of function
How to create struct variables?
Compare and contrast compilers from interpreters.
What do header files do?
What is difference between stdio h and conio h?
which is an algorithm for sorting in a growing Lexicographic order
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
write a program to generate address labels using structures?
long int size a) 4 bytes b) 2 bytes c) compiler dependent d) 8 bytes
18 Answers Acropolis, HCL, Intel, TCS,
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);