Hello, I'm new to C Programming just finished lesson 2.
I'm trying to compile my test program that contains stuffs i learned from lesson 1 and 2, i compiled using Code Blocks using GCC compiler, if i start the program using code blocks it runs correctly but if i run the application from its folder it doesn't, it exits after i press enter without going to the next actions.
Can someone tell me how to compile it to run for Windows Vista using code blocks?Thanks in advance!
Code:
#include <stdio.h>
int main()
{
printf ("Welcome\n");
int age;
printf ("Please enter your age before you can continue:");
scanf ("%d", &age);
if (age<18) {
printf ("You are too young, Please enter to exit.\n");
getchar();
return 0;
}
printf ("You are %d yrs old, cool.\n", age);
getchar();
return 0;
}