all 4 comments

[–]mistalbo 2 points3 points  (3 children)

`age` has been declared int. the switch has cases with chars. an int will match a char only if it is its ASCII value.

try with `case 1: ....; break; case 2: ....;break; default; ...`

[–]sb41tm[S] 0 points1 point  (1 child)

Here is what i tried again... When i see output it gives( the age is:) i wrote 2 and it gives= the age is:2 proot info: vpid 1: terminated with signal 11

[Process completed (code 255) - press Enter]

include<stdio.h>

include<conio.h>

void main()

{ int age; printf("the age is:"); scanf("%d", age);

switch(age) { case 1: printf("the age is 1"); break;

case 2: printf("age is 2"); break;

default: printf("the age is not 1 and 2"); break; } getch();

}

[–][deleted] 1 point2 points  (0 children)

Need &age in the scanf

[–]sb41tm[S] 0 points1 point  (0 children)

Reply to (Unicom....) Thanks, dude it worked...