what would be the output of the following program
main()
{
int a[] = {1,2,3,4,5};
int *ptr = {a,a+1,a+2,a+3,a+4};
printf("%d %d %d %d",a,*ptr,**ptr,ptr);
}
}
Answer Posted / vadivelt
Output:
1.Base address of 'a'
2.Base address of 'a' (Since ptr holds address of the array 'a')
3.Value at the base address of 'a' ie., 1
4.Base address of array of pointers ie., address of 'ptr'
The above answer is valid provided the initialisation of *ptr
should be a array of pointers.
ie., initialisation should be int *ptr[]=
{a,a+1,a+2,a+3,a+4};
Otherwise it leads to compilation error
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain how can type-insensitive macros be created?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
Is it valid to address one element beyond the end of an array?
What are near, far and huge pointers?
What is a structure member in c?
Can we compile a program without main() function?
What are the application of void data type in c?
How is a structure member accessed?
Can a pointer be static?
What are global variables?
When is a null pointer used?
What is void pointers in c?
What is the significance of scope resolution operator?
what is bit rate & baud rate? plz give wave forms