That doesn't work for negative numbers, by the way.
Thanks,
--
Kenneth G. Cavness
Software Engineer
Proxicom, Inc.
-----Original Message-----
From: Daniel Koepke <dkoepke@CALIFORNIA.COM>
To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
Date: Monday, November 03, 1997 11:19 AM
Subject: Re: Hacker MUDSTEALER ALERT
On Mon, 3 Nov 1997, Angus Mezick wrote:
-> A couple of fun questions to ask a potential coder:
-> What is the difference between i++ and ++i?
<g> This one is always fun, because they only act differently in
certain situations. "++i;" and "i++;" are technically the same
when they stand alone, but different in "s[++i] = 'a'+i;" and
"s[i++" = 'a'+i;". That's actually not bad. :)
-> How do you switch the position of 2 int variables without using a temp
-> variable?
Most coders don't know this one, though. It's really simple,
actually, and involves three steps:
a = a xor b;
b = b xor a;
a = a xor b;
I just use the macro "#define SWAP(a,b) { a ^= b; b ^= a; a ^= b }".
Even if a lot of people knew this one, I doubt it has any use in
CircleMUD.
-> How would you divide by 2 with out '/'?
I suppose that's helpful because Circle does it in some places. If
I remember correctly (I always get my left and right shifts mixed-up)
it's (x>>1).
-> What does (1<<2) become?
Again, assuming I haven't mixed-up right and left bit shifts, this
would be four. :)
-> How would you write scanf to read "int int int char" into t[3] and
-> letter?
Generally Circle uses sscanf() or fscanf(). So, it might be useful to
ask what the differences between scanf(), sscanf(), and fscanf() are.
The first few chapters in a book of C cover scanf() [well, I would
think so, I don't think I ever really read one of them], but generally
not sscanf() and fscanf(). It's also kindof of a common sense
question.
-> Why are manholes round?
Because if they were square they'd take up more area?
-> I use these when interviewing, give me a good idea of their experience
-> with the code base and C in general. well, maybe not the last one.
Not a bad suggestion for a lot of you newbies looking for coders.
daniel koepke / dkoepke@california.com
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST