-
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);
}
-
- 3
- 4
- 5
- Compilation Error
- 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;