|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
shadowclaw3 Expert Cheater Reputation: 0
Joined: 05 Aug 2007 Posts: 114
|
Posted: Tue Apr 07, 2009 6:44 pm Post subject: |
|
|
ahh cool, thanks just needed to clear that.
dont think i need your msn with such fast replies lol,
thanks again.
EDIT:
Code: | // pointer to functions
#include <iostream>
using namespace std;
int addition (int a, int b)
{ return (a+b); }
int subtraction (int a, int b)
{ return (a-b); }
int operation (int x, int y, int (*functocall)(int,int))
{
int g;
g = (*functocall)(x,y);
return (g);
}
int main ()
{
int m,n;
int (*minus)(int,int) = subtraction;
m = operation (7, 5, addition);
n = operation (20, m, minus);
cout <<n;
return 0;
} |
im not understanding this lesson so well, can someone explain all the parts? or maybe just
int (*minus)(int,int) = subtraction;
and how to do
m = operation (7, 5, addition);
n = operation (20, m, minus);
_________________
<(~.~<) BOO! |
|
Back to top |
|
|
Flyte Peanuts!!!! Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Thu Apr 09, 2009 12:07 am Post subject: |
|
|
shadowclaw3 wrote: | im not understanding this lesson so well, can someone explain all the parts? or maybe just
int (*minus)(int,int) = subtraction; |
That is a function cast. You can use it to call functions dynamically (like the address you get from using the GetProcAddress() function).
shadowclaw3 wrote: | and how to do
m = operation (7, 5, addition);
n = operation (20, m, minus); |
You are passing the pointer to the start of the code of the function. The function then takes the pointer and casts it into a function, as said previously.
Also, in the future, delete your post then repost it so it gets bumped up to the top. I didn't see the edit until just now.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|