TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Interesting C Interview Questions and Answers

40 pointsby giZm0over 12 years ago

8 comments

kstenerudover 12 years ago
Question 10 is a bad question. The host environment is under no obligation to provide you with pointers to writable memory in argv. Furthermore, this is veering off from C knowledge into C trivia.<p>Question 12 is even worse, as the processing order is implementation defined. On my compiler, it prints out 60..40..60.<p>C questions should be designed to show whether or not the candidate can write robust, professional quality code, not to test esoteric knowledge that even the interviewer can't get right.<p>I was asked questions like these in an interview once. It was such a massive red flag to me that I went with another company (the final straw was arguing over the size of int, which he insisted was always 32 bits).
评论 #4446018 未加载
评论 #4446035 未加载
评论 #4446026 未加载
评论 #4446291 未加载
评论 #4446112 未加载
jdolinerover 12 years ago
<i>Well, Though the above code is not freeing up the memory allocated to ‘ptr’ but still this would not cause a memory leak as after the processing is done the program exits.</i><p>Well this is always true, so I guess that means there's no such thing as memory leaks in C. Checkmate garbage collectors.
评论 #4447149 未加载
评论 #4446243 未加载
joezydecoover 12 years ago
Don't give me hints in the title of the question! That kind of wrecked the challenge.
mitjakover 12 years ago
I've studied most of these as part of my introductory C course in university. Are they really that interesting?
评论 #4446076 未加载
评论 #4445950 未加载
评论 #4445971 未加载
mikeashover 12 years ago
I wonder why there are so many articles about C getting passed around where the author just doesn't know the language that well, or at the very least ventures well outside the boundaries of his knowledge. Where are the <i>good</i> articles on C, and why don't they ever show up on HN?
评论 #4446171 未加载
JBionicsover 12 years ago
For those of you interested, the first stage in the SpaceX interview process, at least for the flight software group, is a series of questions like these, with A-G multiple choice answers. You had to identify the class of bug.<p>The G choice was always "No, looks good".<p>It's timed.
romacover 12 years ago
Here is another interesting C/Objective-C Q&#38;A: <a href="http://www.eosgarden.com/en/articles/objc-quizz/" rel="nofollow">http://www.eosgarden.com/en/articles/objc-quizz/</a>
lurker14over 12 years ago
Is there a reason for any modern compiler to support linking to functions like gets() without setting an "--use-unsafe-libraries" flag?