![]() |
| | #1 |
| VA National Guard Join Date: May 2004 Location: Manassas, VA USA
Posts: 902
| bit o' fun Code: #include <stdio.h>
int main(void) {
int i = 5;
/* Add a line of code here to make the printf() below output 5 */
i = 8;
printf("%d\n", i);
return 0;
}
__________________
|
| The Brain is offline | |
| | #2 |
| carry on Join Date: Feb 2003 Location: Seattle, WA
Posts: 1,971
| Umm: Code: #include <stdio.h>
int main(void) {
int i = 5;
#define printf printf("5\n");
i = 8;
printf("%d\n", i);
return 0;
}
__________________ "Think not but that I know these things; or think I know them not: not therefore am I short Of knowing what I ought." -John Milton, Paradise Regained (1671) "Work hard and it might happen." -XSquared |
| JaWiB is offline | |
| | #3 |
| VA National Guard Join Date: May 2004 Location: Manassas, VA USA
Posts: 902
| anyone come up with anything different..??
__________________
|
| The Brain is offline | |
| | #4 |
| Dump Truck Internet Join Date: Jul 2005
Posts: 357
| Same idea: Code: #include <stdio.h>
int main(void)
{
int i = 5;
#define jab \
i = 8;
printf("%d\n", i);
return(0);
}
Code: #include <stdio.h>
int main(void)
{
int i = 5;
__asm add ebp,4
i = 8;
__asm sub ebp,4
printf("%d\n", i);
return(0);
}
|
| valis is offline | |
| | #5 |
| VA National Guard Join Date: May 2004 Location: Manassas, VA USA
Posts: 902
| used more than one line..!!! :P
__________________
|
| The Brain is offline | |
| | #6 |
| ... Join Date: Jan 2003
Posts: 1,190
| Code: #include <stdio.h>
int main(void)
{
int i = 5;
if (i == 0)
i = 8;
printf("%d\n", i);
return 0;
}
|
| kermit is offline | |
| | #7 |
| Tropical Coder Join Date: Mar 2005 Location: Cayman Islands
Posts: 503
| Code: #include <stdio.h>
int main(void) {
int i = 5;
while(false)
i = 8;
printf("%d\n", i);
return 0;
}
Last edited by Darryl; 12-02-2005 at 08:33 PM. |
| Darryl is offline | |
| | #8 |
| Registered User Join Date: Jan 2005
Posts: 847
| Some more x86 asm. Code: #include <stdio.h>
int main(void) {
int i = 5;
a: __asm jmp a+12
i = 8;
printf("%d\n", i);
return 0;
}
|
| Quantum1024 is offline | |
| | #9 |
| Anti-Poster Join Date: Feb 2002
Posts: 1,212
| Bah...why not? Code: #include <stdio.h>
int main(void)
{
int i = 5;
return printf("5"),0;
i = 8;
printf("%d\n", i);
return 0;
}
__________________ Rule #1: Every rule has exceptions Traveller's Dilemma Contest Site - Results posted! |
| pianorain is offline | |
| | #10 |
| Registered User Join Date: Dec 2002
Posts: 409
| Code: #include <stdio.h>
int main(void) {
int i = 5;
/* Add a line of code here to make the printf() below output 5 meow!
i = 8; */
printf("%d\n", i);
return 0;
}
|
| kryptkat is offline | |
| | #11 | |
| Supermassive black hole Join Date: Jul 2005 Location: South Wales, UK
Posts: 1,709
| Quote:
__________________ Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife. - Mike McShaffry | |
| ahluka is offline | |
| | #12 |
| Registered User Join Date: Aug 2001
Posts: 244
| no, Code: a: __asm jmp a+12 i = 8;
__________________ signature under construction |
| Raven Arkadon is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| copying or concatinating string from 1st bit, leaving 0th bit | spanian2708 | C Programming | 3 | 11-10-2005 10:53 AM |
| porting application from 32 bit to 64 bit error | gandalf_bar | Linux Programming | 1 | 09-14-2005 09:20 AM |
| Bit processing in C | eliomancini | C Programming | 8 | 06-07-2005 10:54 AM |
| Bit Manipulation Questions | CPPNewbie | C++ Programming | 7 | 08-12-2003 02:17 PM |
| Array of boolean | DMaxJ | C++ Programming | 11 | 10-25-2001 11:45 PM |