conditional operator

cindrilla's Avatar, Join Date: Sep 2010
Go4Expert Member
hi firnds i hv some probs with using conditional operator
my program is to find whether a candidate is elgible for voting or not

first i had made my program as shown below


#include<stdio.h>
main()
{
printf("enter d age");
scanf("%d",&a);
(a>=18) ? printf("ur elgible"); : printf("ur inelgible");
}


but this is showing errors as expected ecpression before :
&
expected ':' before ';' token
wht d hell is all this mean
im using unix mint
0
jimblumberg's Avatar
Ambitious contributor
Probably means remove the semicolon before the colon.

Jim
0
cindrilla's Avatar, Join Date: Sep 2010
Go4Expert Member
hey ur exact thnx