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


Please Help Members By Posting Answers For Below Questions

What is string function c?

657


What are the properties of union in c?

679


What are terms in math?

683


What is self-referential structure in c programming?

751


What is the use of f in c?

647






Explain how can I convert a number to a string?

724


Why is main function so important?

713


Explain how can you determine the size of an allocated portion of memory?

717


Why does notstrcat(string, "!");Work?

764


Write a program to check whether a number is prime or not using c?

678


Is that possible to add pointers to each other?

999


difference between Low, Middle, High Level languages in c ?

1738


What is structure padding and packing in c?

714


What is the use of bitwise operator?

776


Explain b+ tree?

730