Well am learning C, and this is probably the stupidest question, but here it comes:
I'm using "getchar()" to stop the command windows so I can see the exercises am doing but it just don't work. heres a sample:
#include <stdio.h>
int main()
{
int value;
printf("1. option 1.\n2. option 2.\n3. option 3.\n4. Exit\n\nMake an option: ");
scanf("%d", &value);
switch (value)
{
case 1:
printf("you selected the option 1.");
break;
case 2:
printf("you selected the option 2.");
break;
case 3:
printf("you selected the option 3.");
break;
case 4:
printf("goodbye");
break;
default:
printf("thats not an option");
break;
}
getchar();
return 0;
}
this is the output:
- option 1.
- option 2.
- option 3.
- Exit.
Make an option: 1
you selected the option 1.
Process returned 0 (0x0) execution time : 3.453 s
Press any key to continue.
it doesn't wait for the input of "getchar()".
I'm on XP using minGW with codeblocks..