10 / 24
Dec 2005

Hmmm... What is the authoritative reference for your "Standard C"?

The ultimate "reference" is my judge program. wink
Both solutions are valid C90 (ISO 9899:1990) and C99 (ISO 9899:1999). At least one of them wouldn't work in certain traditional (pre-standard) compilers but I doubt anyone of you uses a >20 years old compiler.

17 days later

i have figured out one solution ...........
but the other one i am finding it tough .........

the hardest part of this problem is testing. since mauke says both of my solutions are buggy im guessing something i used is part of GCC extensions but not C99, which means ive found 0 instead of 1 solution. if i had a "standard" compiler to throw ideas at id probably take another look at this one, but until then im not quite up to the task of re-reading the standards.

-Wall -ansi -pedantic

to gcc does a good job of identifying non-ANSI constructs. Give it a try, anyway.

Or maybe it means that your answer doesn't actually declare the right kind of type under any compiler.

1 month later

I found the obvious/**/solution, any hints on the second part? Especially, a clarification what is and what isn't whitespace would be really nice.

Huhu, I found the "obvious" other solution first; the /**/ thing was an afterthought. I'm pretty sure that whitespaceless C is turing-complete, even without preprocessor tricks like comments.

"Whitespace" is a sequence of 1 or more white characters. White characters recognized by the judge include: ' ' (space), '\t', (tab), '\n' (newline), '\r' (carriage return), '\f' (form feed) and '\v' (vertical tab). No other ASCII char is white, but there may be other white characters such as char 160 (non-breaking space); I haven't tested those.

A general comment: '\0' (NUL) isn't whitespace. It can't be used to separate tokens either. (I don't care if this works in gcc.)

1 month later

No, but I'd like to see you use #define without putting whitespace between it and the following identifier...

Oops, I know how to do it, but it's still not allowed: The problem description asks for a declaration/type definition. #define is just token replacement.

Ok. And another one.
Does right solution work correctly on C++? (I'm just have no normal C compiler for experiments:) )

10 months later

I have a question.
How much different should the two submissions be? My submissions gives WA even if I used two distinct tricks.

14 days later

Pardon the revival of this thread, but do we use
"char * const"
or
"const char *"
? The description is rather ambiguous about this, and I think I am being rejected because I may have the wrong one (it makes a huge difference to the token-parsing and stuff, and the amount of hackish things you need to make it work)

3 months later

nneonneo, it's char*const. meaning a pointer to char that can't point anywhere else, but the thing pointed to can change.

besides /**/, what else have you come up with?

1 month later

I came up with a solution ( and read misof's solution for the other trick). I am able to compile the solution with gcc 3.3.3 but I am getting WA.

4 years later

typedef/**/struct{unsigned/**/aku;char/**/*const/**/soku}zan;
typedef/**/struct{unsigned(aku);char*const(soku)}zan;

Can someone point out whats wrong with these declarations....I am going mad with this problem.... frowning spoj.pl/status/HAJIME,saurabh8c/3

11 days later

I would also appreciate a hint on how to deal with the space between "typedef" and "struct" other than the comment trick. I can't think of any other way to avoid whitespace there.

16 days later

@saurabhcc:
Your second declaration used the same trick as the first one, namely /**/.
You are almost there. wink

3 months later

I m fed of finding how to replace the space between typedef and struct .please help me someone,I read lot of articles on net but of no use.now, I also tried 100's of different hit and trial combinations but of no use.

9 years later

@mauke I’ve found this solution, but it is not accepted
__INT32_C(typedef)__INT32_C(struct{__INT32_C(__UINT32_TYPE__)__INT32_C(aku;char*const)__INT32_C(soku;}zan;))
typedef/**/struct{__UINT32_TYPE__/**/aku;char*const/**/soku;}zan;
but it is correct