So I dont know why this will not work...everything looks fine.....Ive been writing code for 4hrs this morning so its probably the smallest thing Im missing and ho[ing someone can spot it out for me....thanks in advance....my eyes are bugging!
Code:
#include<stdio.h>
main()
{
int n;
printf("Please enter a single digit for a car.\n");
printf("(within the range of 1 to 3):\n");
switch(n) {
case '1':
printf("Car 1 is a Ford\n");
break;
case'2':
printf("Car 2 is a Chev\n");
break;
case'3':
printf("Car 3 is a Foreign\n");
break;
default:
break;
}
return 0; //Return to the IDE
}
What Im trying to do is get is to ask me to input 1, 2 or 3 and it will display Ford, Chev, or Foreign. Its ........ing me off that I cannot find the problem. I get error saying 'n' in not initialized, when it is.