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);
}

}



what would be the output of the following program main() { int a[] = {1,2,3,4,5}; int *ptr =..

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

More C Interview Questions

Describe the difference between = and == symbols in c programming?

0 Answers  


34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?

0 Answers  


what is ans for this scanf(%%d",c);

1 Answers  


What is the significance of c program algorithms?

0 Answers  


Explain what is wrong with this program statement? Void = 10;

0 Answers  






Write a program to compute the following 1!+2!+...n!

4 Answers  


what is foreign key in c language?

1 Answers   ADP,


what is the difference between #include<stdio.h> and #include "stdio.h" ?

3 Answers  


what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??

5 Answers  


What is hashing in c language?

0 Answers  


Reverse the bit order in a single macro. eg. i/p = 10010101 --> o/p = 10101001

2 Answers  


Why isn't any of this standardized in c? Any real program has to do some of these things.

0 Answers  


Categories