Find the output of C programs
Program 1
gd.c
#include <stdio.h>
int main()
{
    int x = 5;
    if (x == 5)
        printf("%d\n", !x);
    else
        printf("%d\n", x);
    return 0;
}
godarda@gd:~$ gcc gd.c
godarda@gd:~$ ./a.out 0 godarda@gd:~$
Program 2
gd.c
#include <stdio.h>
int main()
{
    int x = 0;
    if (!x)
        printf("%d\n", !x);
    else
        printf("%d\n", x);
    return 0;
}
godarda@gd:~$ gcc gd.c
godarda@gd:~$ ./a.out 1 godarda@gd:~$
Program 3
gd.c
#include <stdio.h>
int main()
{
    int x = 5;
    if (x)
        printf("%d\n", !x);
    else
        printf("%d\n", x);
    return 0;
}
godarda@gd:~$ gcc gd.c
godarda@gd:~$ ./a.out 0 godarda@gd:~$
Comments and Reactions
What Next?
C Loops