ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
This is to inform you all that I have posted a new C quiz named "Brain Teasers in C". The Part - I of this is now available in the quiz section of this site. So I am requesting you all the members of this forum to take part in this quiz. I am assuring that you all will enjoy this. Moreover please pass this to others and encourage others to take part.
Beware, Think twice before answering a questions, because most of them are tricky in nature.
Comments are welcoming always. Please write your comments in the quiz section.
There are some errors and omissions as I see it. First your code examples don't include headers,functions without prototypes is _bad_. Second you never specify which compiler.
I did the quiz in regard to gcc 3.2.3
Question 1: Answer is actually linker error not compiler error.
Question 5: Doesn't have an answer in the options. The problem is that a and b are out of scope for the function sum. Returning the value returned by printf is fine but _not_ what would be logically intended.
I got 9 out of 10. I missed #5 but I can't feel bad about that since there wasn't a right answer. Now that I look back at it I should have chosen 302. The answer marked as being correct...even though it's even further from correct than the compiler error option.
I'm not trying to troll. You guys _do_ peer review these before posting them right?
If I remember right, wasn't 5 the one that first printed out 10 + 20 (thus printing 30), then return the value from that printf (which would be 2 since 2 characters were printed), and then it prints that return value. (Thus 302 would be printed, assuming there was no \n after printing 10+20.)
I missed a few of them just because I didn't look at the code close enough, and I wanted to kick myself. Like on number 2 with the extern int i... I didn't see i being defined below that until after I was done and got the answers back. That last one, I didn't even really try. I was at work, and didn't want to take the time to try and figure it out right then.