-
typedef
can any body tell me the answer to this question plz
create snippet of C code that consists of two declarations defining a type called "zan", which should be a struct containing two members: first an unsigned int called "aku", then a constant pointer to char called "soku".
To make things more interesting, you can't use any whitespace in either declaration, and the two declarations must be sufficiently dissimilar (basically, you have to use two different tricks to get around the lack of whitespace).
i have figured out one solution
Code:
typedef/**/struct/**/{unsigned/**/*aku;char/**/*soku;}zan;
here i use /* */ comments to delimit the keywords.
but i cant get the other solution
-
And the point of doing this is what?
-
nothing. it just tests your knowledge of the C language.
-
Congratulations then - you know that /**/ can be used wherever white space should be used.
Now can you tell us whether this would work on a pre ANSI compiler?
-
i dont know if it works on a pre ANSI C compiler or not.
can u tell me some pre ANSI C compiler in use today ???
-
You're going to have to do more than 4 minutes research!
-
i cant spend so much time ...........
u tell me
-
do you know the other solution by the way oh mighty "GOD OF C " ????
-
you don't need any "whitespace" here except the first one
-
done.
i will use only a single comment in this solution to delimit the tokens.
but whats the other solution. did anybody get any ideas ?
-
You're not even close to what your program's description is. You don't have an unsigned int. You have a pointer. You also don't have a constant pointer to a character.
Quzah.
-
well the example is just to show you the use of /* comments */ to delimit the tokens thats it.
it isnt very hard to fill in the other things. if you are still not satisified then here is the EXACT solution required
Code:
typedef/**/struct{unsigned/**/aku;const/**/char/**/*soku;}zan;
now tell me if you can help me to find the other solution :D
-
Well, comments technically are whitespace.
Quzah.
-
well we all have figured that out by now................ but i am dying to know the other solution :(
-
Well if you're using comments, then none of you have it figured out, because comments are whitespace. Either that or your instructor or whoever came up with this bright idea, is wrong in their explanation of the problem. That is the problem with these types of "trick problems".
Quzah.