Day#67 'C' Coding Challenge

Day#67 'C' Coding Challenge

What is the output of the below code?

#include<stdio.h> void main() { int var; var = func(); printf("%d", var); int var1 = 7; var1 = func(); printf("%d", var1); } void func(void) { }

-----------------------------------------------------------

The above code tests a scenario where a function has been called and it doesn't return a value. But the calling function has assigned return value to variable. In this scenario, when function is not returning a value, the value assigned is not a valid and can be said garbage. This is the case with both scenarios where a variable has been initialized and a case where variable has not been initialized.

Post a Comment

0 Comments