3
Hello, I’m trying to return a struct from a function when it’s called on main. I did the whole function and set in the end two elements which are calculated in function:
int mult[100];
char** elemfim = (char**)malloc(100 * sizeof(char*));
I want to put these two in a struct to give Return to the main.
So I set at the beginning of the program like this:
struct elementodos{
int multidor[100];
char** cadaum;
};
elementodos interpretar(char* element);
but it generates an errp when I define my function, in part:
elementodos interpretar(char* element);
Shouldn’t I set my function like this? so I can put a struct re-turn?
You forgot to say which error it generates.
– Gabriel
Try it like this:
struct elementodos interpretar(char* element);
– user98628
Thank you Paulo Imon, that was the first part at least.
– Patrick Machado
Oops! But in case this is just the signature of your function, you will have to change in function too.
– user98628
I changed there too and it worked, puts as an answer to accept. Thank you very much.
– Patrick Machado
Ready! Thanks! D
– user98628