What will be the output?
main()
{
char *p;
p = "Hello";
printf("%cn",*&*p);
}
main()
{
char *p;
p = "Hello";
printf("%cn",*&*p);
}
A. Hello
B. H
C. Some address will be printed
D. None of these.
Answer: Option B
Solution(By Examveda Team)
* is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string "Hello". *p dereferences it and so its value is H. Again & references it to an address and * dereferences it to the value H.
Join The Discussion
Comments ( 2 )
In C, what is a pointer primarily used for?
A. Decision making
B. Code organization
C. Variable declaration
D. Storing values
In C, how do you declare a pointer variable that can store the address of an integer?
A. int *ptr;
B. ptr int;
C. int ptr;
D. ptr *int;
What is the purpose of the '->' operator in C when used with pointers?
A. Arithmetic operation
B. Indirection operator
C. Member access operator
D. Bitwise operation
%cn .when n don't consider answer is a
'b'.
Answer should be Hn so d option should be correct