"Bill Cunningham" <nospam@[EMAIL PROTECTED]
> ha scritto nel messaggio
news:LzJUj.24523$qW.3229@[EMAIL PROTECTED]
>
> "rio" <a@[EMAIL PROTECTED]
> wrote in message
> news:4822d8eb$0$41661$4fafbaef@[EMAIL PROTECTED]
>
>> i like below
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>>
>> int main(int argc, char **argv)
>> {double x, y;
>>
>> if (argc!=3) { fprintf(stderr,"usage error\n"); return -1;}
>>
>> x=strtod(argv[1], 0);
>> y=strtod(argv[2], 0);
>>
>> return (x!=0.0) ?
>> (printf("%.2f\n", y/x), 0): (printf("Error: x==0\n"), -1)
;
>> }
>
> This is the part that goes over my head with my knowledge.
>
> return (x!=0.0) ? /*what's the ? and 0.0 for */
if "x" is 0.0, y/x should be here a seg-fault.
For don't allow this the program says there is an input error because
x==0,
and the program return -1 the error code.
> There are things in C, shortcuts that I haven't grasped yet like += and
?:
> I do things the long way right now.
this is what i like
> Bill


|