Home » C Programming » Operators » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int k = 3;
    int k = k++ + k;
    printf("%d\n", k);
    }
    1. 3
    2. 4
    3. 5
    4. Compilation Error
    5. None of these
Correct Option: D

Compilation Error

main.c: In function ‘main’:
main.c:5:13: error: redefinition of ‘k’
int k = k++ + k;
^
main.c:4:13: note: previous definition of ‘k’ was here
int k = 3;



Your comments will be displayed only after manual approval.