Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 3;
const int *p = &x;
*p++;
printf(“%d\n”, *p);
}

What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 3;
const int *p = &x;
*p++;
printf(“%d\n”, *p);
}
a) Increment of read-only location compile error
b) 4
c) Some garbage value
d) Undefined behaviour

Answer: c

Join The Discussion