Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 206

Relationship between return value and garbage value

$
0
0

What happens if the return statement does not produce a return value in a function that produces a return value in C language? Does the compiler use garbage values in this case? Is this called undefined behavior?

For example;

#include <stdio.h>int func() {}int main() {    int result = func();    printf("Result: %d\n", result);    return 0;}

Output of this code :Result: 0

I am expecting this is a undefined behavior.


Viewing all articles
Browse latest Browse all 206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>