Walter Roberson wrote:
> In article <. com>,
> sandeep <> wrote:
> :Answer will be 'b'
>
> What answer will be 'b'? You didn't quote any establishing context.
>
> :It will print out the computer's internal code for the character '7'
>
> Obviously you didn't try it.
What made u think that i didn,t tried that
I tried and i got "55" as the internal value of '7'.
Which is also the ASCII value for "7".
Now i got it correct and you might be having some problem with your
compiler or you missed something.
anyways be careful in future.
>
> $ gcc -std=c89 -pedantic -o seven seven.c
> seven.c:3: error: conflicting types for `Ch'
> seven.c:1: error: previous declaration of `Ch'
> seven.c:3: error: ISO C forbids data definition with no type or storage class
> seven.c:5: error: parse error before string constant
> seven.c:5: warning: conflicting types for built-in function `printf'
> seven.c:5: error: ISO C forbids data definition with no type or storage class
>
> $ gcc -std=c99 -pedantic -o seven seven.c
> seven.c:3: warning: type defaults to `int' in declaration of `Ch'
> seven.c:3: error: conflicting types for `Ch'
> seven.c:1: error: previous declaration of `Ch'
> seven.c:3: error: ISO C forbids data definition with no type or storage class
> seven.c:5: error: parse error before string constant
> seven.c:5: warning: type defaults to `int' in declaration of `printf'
> seven.c:5: warning: conflicting types for built-in function `printf'
> seven.c:5: error: ISO C forbids data definition with no type or storage class
>
> $ : SGI IRIX below
>
> $ cc -o seven -fullwarn seven.c
> cc-1077 cc: ERROR File = seven.c, Line = 3
> The indicated declaration has no storage class or type specifier.
>
> Ch = '7';
> ^
>
> cc-1143 cc: ERROR File = seven.c, Line = 3
> Declaration is incompatible with "char Ch" (declared at line 1).
>
> Ch = '7';
> ^
>
> cc-1079 cc: ERROR File = seven.c, Line = 5
> A type specifier is expected.
>
> printf("%d\n", Ch);
> ^
>
> cc-1079 cc: ERROR File = seven.c, Line = 5
> A type specifier is expected.
>
> printf("%d\n", Ch);
> ^
>
> cc-1077 cc: WARNING File = seven.c, Line = 5
> The indicated declaration has no storage class or type specifier.
>
> printf("%d\n", Ch);
> ^
>
> 4 errors detected in the compilation of "seven.c".
>
> --
> Any sufficiently advanced bug is indistinguishable from a feature.
> -- Rich Kulawiec
|