My questions are:
Is this a bad cut & paste?
If not:
Who wants you to deal with this piece of trash code?
When will you ever do something like this (and keep your job)?
Why do people insist on teaching this crap?
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
> I got this question from a C problem set.
Which one, I feel like complaining to them about posting crap.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
uh-ooh you aroused the 'C decency committee'
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
@Salem
This is one of those problem sets which prepares you for the job interviews.
If this came from a job-interview, youdo not want to be working for this company. When they give you this just put on a disgusted face and walk away :)
Nick Evan
Not a Llama
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
To help put this to rest, try running this code
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, j;
fprintf(stdout, "---- %s ----\n", "%d %d"+scanf("%d %d", &i, &j));
return 0;
}
You should get output similar to this:
---- %d ----
Which is what is passed to the second scanf..
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
> This is one of those problem sets which prepares you for the job interviews.
After half a dozen clicks on that site (or should I say, "what a sight!"), it's disgusting what rubbish people spout as being good answers. There's no end of "Well my compiler does this, therefore it's the right answer".
Prepare - what a laugh.
Anyone armed with that information will either fail the interview or get confused on the first programming assignment.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Why does scanf("%d %d"+2) become scanf("%d") ?
Would the following be of any help?
#include <stdio.h>
int main(void)
{
char const * p = "invisible text" + 10;
printf("%s", p);
return 0;
}
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395