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
What does. int *x[](); means ?
What does sizeof return c?
What are static variables in c?
What is the use of sizeof () in c?
What is quick sort in c?
develop algorithms to add polynomials (i) in one variable
What are the 4 types of unions?
Why doesnt this code work?
What is the use of sizeof?
Why c is called object oriented language?
What are pointers? What are stacks and queues?
How can I avoid the abort, retry, fail messages?
What is a pointer on a pointer in c programming language?
What is a function simple definition?
What is the use of clrscr?