strange output in c program
Poul-Henning Kamp
phk at phk.freebsd.dk
Wed Jul 8 11:42:54 UTC 2020
--------
rahul deshmukh writes:
> #include <stdio.h>
> int main()
> {
> int a = 300, b, c;
> if(a >= 400)
> {
> printf("shouldn't print\n");
> b = 300;
> }
> c=200;
> printf("%d %d\n", b, c);
> return 0;
> }
> =========================================================
> rdx at FreeBSD:~/Projects/Clang/chapter3 % make example6
> `example6' is up to date.
> rdx at FreeBSD:~/Projects/Clang/chapter3 % ./example6
> 300 200==> should be garbage value instead of 300?
300 is a perfectly valid garbage value :-)
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-hackers
mailing list