Aspire Faculty ID #17026 · Topic: AMU MCA 2022 · Just now
AMU MCA 2022

What will be the output of the following program?
int main()
{
    int *p, a = 12;
    p = &a;
    *p += 1;
    printf("12,");
    --*p;
    printf("%d, %d\n", *p, a);
    return 0;
}

Solution

a=12 → *p+=1 makes a=13. Then --*p makes a=12. Printed output becomes 12,12,12.

Previous 10 Questions — AMU MCA 2022

Nearest first

Next 10 Questions — AMU MCA 2022

Ascending by ID
Ask Your Question or Put Your Review.

loading...