I have this problem with C.
I have the following statement.
int *a;
a=malloc(100);
And I get the following error:
error: invalid conversion from ‘void*’ to ‘int*’ [-fpermissive]
Any hints on this ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are compiling your code as C++, in which the code you’ve used is not valid. For C though, it is valid and you should not add any cast.
Note, however, that the argument to
malloc()is inchars, so “100” is a bit random. If you want 100 integers, do: