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);
}
}
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 |
where do we use volatile keyword?
If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.
For what purpose null pointer used?
What are the types of operators in c?
Explain how can I convert a string to a number?
Why do we need arrays in c?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
What is the use of getchar() function?
write a program to sort the elements in a given array in c language
What should malloc() do?
Disadvantages of C language.
what is difference between strcmp & palindrome?