Hi I'm having a problem using a struct
as a parameter.
My struct looks the following:
typedef struct temps {
string name;
float max;
} temps;
I can use it in my main without problems like:
temps t;
t.max = 1.0;
but using it in a function signatures like this:
void printTemps(const temps& t) {
cout << t.name << endl << "MAX: " << t.max << endl;
}
It gives me the following compiler message:
error C2563: mismatch in formal parameter list
Here is a mwe:
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <Lmcons.h>
using namespace std;
typedef struct temps {
string name;
float max;
} temps;
void printTemps(const temps& t) {
cout << t.name << endl << "MAX: " << t.max << endl;
}
int main(int argc, char **argv)
{
temps t;
t.max = 1.0;
printTemps(t);
}
Any ideas whats wrong on the struct?