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; }
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; }
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
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
anyone come up with anything different..??
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
Same idea:
or with two lines (under the assumption your x86)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); }
used more than one line..!!! :P
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
I know its kind of cheesey...Code:#include <stdio.h> int main(void) { int i = 5; if (i == 0) i = 8; printf("%d\n", i); return 0; }
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.
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; }
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; }
If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein
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; }
Does that mean "i = 8;" is 12 bytes long in the .exe?Originally Posted by Quantum1024
Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.
- Mike McShaffry
no,
is assumed to be 12 bytes long i = 8; AND the jmpCode:a: __asm jmp a+12 i = 8;
signature under construction