Last edited by nirmaljoe1; 05-10-2011 at 12:25 PM. Reason: Removing the post.
Except the code is not indented, which is completely ridiculous.
Somebody at "<<OP doesn't care anymore>>" needs to read this:
Paragraphs, Lines, and Phrases
If you learn from that mess, you're learning a load of rubbish.
All the ones with void main are wrong.
All the ones which assume string literals are writeable are wrong.
All the ones which assume evaluation order are wrong.
All the ones which assume specific sizes for int, pointer etc, are compiler specific (without you saying which compiler it is, though I can guess it's probably TurbidCrap).
Salem, Its my friend's website.Can you help with your valuable comments in a positive way.He actually wants someone to correct and help him in posting good quality articles in that website.You can post your valuable comment in that website. Thanks to you in advance for my friend...
Worse than that, these puzzles look like they were written by somebody using the undead Borland Turbo C compiler. This sounds like shameless self promotion. For anybody attempting to learn from that site, don't! There are numerous problems. In my first read-through of the questions, I noticed the following problems:
- Cprogramming.com FAQ > main() / void main() / int main() / int main(void) / int main(int argc, char *argv)
- far pointers haven't existed since the 16-bit DOS days
- #2 has an incorrect leap year check. It's years that are divisible by 4, except those divisible by 100 unless they're divisible by 400
- #9 assumes 16 bit integers, which is highly unlikely, and big-endian, which is system dependent
- #20 is wrong, the order in which function parameters are evaluated is unspecified
- #23 is wrong, if printf doesn't have enough parameters for the format specifiers, the behavior is undefined
EDIT: I just noticed your friend has 3 other pages full of bad examples. He ought to take down those things before they cause any harm. I applaud the effort, but your friend is just not ready to share his "knowledge" of C with the rest of the world. And I doubt anybody here wants to read through 100 examples of horribly formatted code with things like "void main", that make most respectable C programmers want to vomit. Tell him to get an up to date compiler, compile all his examples with the strictest warnings on and read the standard to verify that what he's trying to teach is actual proper C.
Last edited by anduril462; 05-10-2011 at 11:47 AM.
You are correct Anduril. I think he has collected these questions from some placement papers used by some Indian software companies.Its really shame that still our top IT companies use outdated questions and forcing people to be fools.Present job placement tests are not enough to measure the actual programming skills.
I would like to consider this as a positive opportunity to find mistakes and strengthen our knowledge by discussing and correcting the errors.
Sure, I will communicate all these corrections and suggestions to my friend.He will correct them soon.
OP no longer interested, so nothing more to add.