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 what is output redirection?
Explain the use of #pragma exit?
What is the use of structure padding in c?
Difference between pass by reference and pass by value?
Does free set pointer to null?
Why n++ execute faster than n+1 ?
What is meant by realloc()?
Explain Function Pointer?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
What is property type c?
When can a far pointer be used?
What is the scope of an external variable in c?
What is operator precedence?
What is pivot in c?
Why c is called object oriented language?