user923005 said:
If the other pages are like this, then Herbert Schildt has met his
match:
http://hitechskill.com/technicalq/IT-Interview-Questions.jsp?type=C&page=1
I already sent them a scathing letter.
Umm... "wow!"
(And see my C-FAQ note at the bottom.)
Let's see:
2.What will be printed as the result of the operation below:
main()
{
int a=20,b=35;
a=b++ + a++;
b= ++b + ++a;
printf("%d%d\n",a,b);
}
Answer : 5794
Perhaps on the poster's particular compiler, with the particular
set of compile-time options, it gives that answer. (And, in an
unfortunate coincidence, my compilers give that output as well.
However, my DS-6000 isn't booted up at the moment. I believe that
someone else on this list has a compiler that would display "a
suffusion of yellow".)
5.What will be printed as the result of the operation below:
main()
{
char *ptr = "SC Systems";
*pt++; printf("%s\n",pt);
pt++;
printf("%s\n",pt);
}
Answer: SC Systems
C Systems
Well, after fixing the pt/ptr typo, I certainly don't get the
"answer" the website provides.
11.What will be printed as the result of the operation below:
main()
{
int x=10, y=15;
x = x++;
y = ++y;
printf("%d %d\n",x,y);
}
Answer: 11, 16
I really should boot up my DS-6000.
And then there's the "I just grabbed the C FAQ, didn't give credit to
the copyright holder, and then did a poor job at trying to hide that
this is what I did". Take a look at this tidbit from page 15:
3. I'm trying to do some simple trig, and I am #including <math.h>,
but I keep getting "undefined: sin" compilation errors.
A: Make sure you're actually linking with the math library. For
instance, under Unix, you usually need to use the -lm option, at
the *end* of the command line, when compiling/linking. 14.4: My
floating-point calculations are acting strangely and giving me
different answers on different machines.
Yup, he can't even properly trim his cut-and-paste, leaving the next
FAQ entry (14.4) in place.
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody |
www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net |
www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:
[email protected]>