Points to remember while coding in C :

– put newline (\n) in your printf so as the output does not overlap with the terminal prompt. – keep clean tab spaces to make code reading easier. – put a getchar() to prevent the program from vanishing after execution (unlikely to happen if run from terminal).

Here’s a short program to recall the basics. :-)

#include
int main()
    {
        int age;
        printf("Please enter your age : ");
        scanf("%d", &age);
        if ( age >= 18 ) {
            printf ("You are a major!\n");
        }
        else if ( age < 18 && age > 12 ) {
            printf ("You are a minor!\n");
        }
        else {
            printf ("You are a kid!\n");
        }
        getchar();
        return 0;
    }

Another point to remember:

Difference between var1 and &var1 in C. – var1 refers to a declared variable – &var1 refers to a memory location