0
Hello, I’m starting to use dynamic memory in c++, but I ran into a problem. When I do new CHAR_INFO[3]
, says
cannot Convert 'CHAR_INFO* {aka _CHAR_INFO*}' to 'int*' in assignment
and still misses this line of code: new std::thread(Func)
, saying
cannot Convert 'mingw_stdthread::thread*' to 'int*' in assignment
what does this error message mean? I can’t use threads or variables of type CHAR_INFO in pointers?
EDIT1:
This is the complete code of the error:
int *BUFFER = NULL;
BUFFER = new CHAR_INFO[3];
delete []BUFFER;
And also this code
int *BUFFER = NULL;
BUFFER = new std::thread(Func);
delete []BUFFER;
The function is of the type void
, unencumbered.
If I put this code separately in a file it gives me the same error.
This is only part of the instructions. Put the complete instructions, to understand where the error comes from
– Isac
@Isac I added the full code to the question
– Simple coder
You are saving an array of the type
CHAR_INFO
in aint*
. This is of course not correct, because they are two different types, and therefore gives error.int*
have to store in one piece.– Isac
@Isac Thanks for the suggestion, it worked, it was enough to change the type of pointer data. I could turn the comment into a reply so I could mark it as correct?
– Simple coder