#include <stdio.h>
main() {
int x = 65, *p = &x;
void *q = p;
char *r = q;
printf("%c", *r);
}
$x = 65$
In ASCII, $65 \equiv A$
Step 2: Pointer flow
$p = \&x \;\; \rightarrow$ pointer to integer
$q = p \;\; \rightarrow$ void pointer
$r = q \;\; \rightarrow$ typecast to char pointer
Step 3: Dereferencing
Since r is char*, it reads 1 byte.
The value stored = $65$
Step 4: Printing
printf("%c", *r); prints character with ASCII $65$.
Hence, the output is:
Correct Answer: (A)
a=10. Unary +a does not increment, it only returns the same value.
ls -a.
extern keyword is used in C to extend variable visibility across multiple files.
x *= x + y means x = x * (x + y) ⇒ 2 * (2 + 1) = 6.
5>8 is false ⇒ evaluate 1 != 2 < 5 ? 20 : 30.2<5 ⇒ 1. Then 1 != 1 ⇒ false ⇒ choose 30.
if(a--) uses 1 (true) then decrements to 0 ⇒ prints "True".if(a++) tests 0 (false) then increments to 1 ⇒ no print.
y (outside initialization),
so it will not compile. Hence, it gives a compilation error.
Online Test Series, Information About Examination,
Syllabus, Notification
and More.
Online Test Series, Information About Examination,
Syllabus, Notification
and More.