Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   conditional operator (http://www.go4expert.com/forums/conditional-operator-t24054/)

cindrilla 2Dec2010 06:59

conditional operator
 
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

jimblumberg 2Dec2010 09:38

Re: conditional operator
 
Probably means remove the semicolon before the colon.

Jim

cindrilla 2Dec2010 17:12

Re: conditional operator
 
hey ur exact thnx


All times are GMT +5.5. The time now is 05:30.