Home » C Programming » Pointers » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    void fun(int*);
    int main()
    {
    int num = 10;
    fun((&num)++);
    }
    void fun(int *ptr)
    {
    printf("%d\n", *ptr);
    }
    1. Compilation Error
    2. 113
    3. Garbage value
    4. Runtime Error
    5. None of these
Correct Option: A

Compilation Error

main.c: In function ‘main’:
main.c:6:19: error: lvalue required as increment operand
fun((&num)++);



Your comments will be displayed only after manual approval.