hi, in the code below :

#include <iostream>
using namespace std;

struct deneme
{

  int a;
  void (* myFunction)(int a);
  
};

void function1(int a)
{
  cout << a << endl;
}

void function2(int a)
{
  cout << a + a << endl;
}
int main()
{
 
  deneme myDeneme[] = {{1,function1},{2,function2}};
  
  myDeneme[0].myFunction(myDeneme[0].a);
  myDeneme[1].myFunction(myDeneme[1].a);
  
  return 0;
}

i get the output:

1
4
which is correct.
My question is : the instance of my struct already includes the integer member "a", instead of passing it to the function as a parameter, is there any way of grabing that information from the struct it self?

Thanks

#include <iostream>
using namespace std;

struct deneme
{
  int a;
  void (* myFunction)(int a);
  void look4adventures() { myFunction(a); }
};

void function1(int a)
{
  cout << a << endl;
}

void function2(int a)
{
  cout << a + a << endl;
}
int main()
{
   deneme myDeneme[] = {{1,function1},{2,function2}};
  
  myDeneme[0].look4adventures();
  myDeneme[1].look4adventures();
  
  return 0;
}
commented: so smart +3

wow, i am really impressed about your approach, thank you so much :) appreciate it.