I have a header file, main cpp file and functions file and am trying to pass a stuct array from the main function to the functions file and can't figure out the syntax. I have stripped the code done to show what I am doing without showing hundreds of lines of code.
I have tried every variation i know of to pass the structure array and it won't compile; I have read everything I could find on it and can't find the solution; I know it is just a syntax thing I'm not figuring out.
header.h file
#ifndef myHeader_h
#define myHeader_h
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
struct MyStruct
{
float var1;
float var2;
float var3;
};
struct MyStruct2
{
string var4;
string var5;
bool var6;
MyStruct struct1;
};
int enterFunction(int maxNumber, int & currentNumber, structList);
#endif
Main Program
#include "myHeader.h"
int main()
{
int currentNumber = 0, maxNumber = 0;
MyStruct *structList;
structList = new MyStuct[maxNumber];
enterFunction(currentNumber, maxNumber, structList);
return 0;
}
Functions file
#include "myHeader.h"
int enterFunction(int maxNumber, int & currentNumber, structList)
{
// DO MORE STUFF HERE
}