1

I know this may sound stupid but, why is this function I implemented not working properly?

I get the following error in the terminal:

cerinta3.c: In function ‘void realocare_memorie(student**, int)’:
cerinta3.c:9:19: error: invalid conversion from ‘void*’ to ‘student*’ [-fpermissive]
    9 |  *vector = realloc(*vector, dimensiune * sizeof(student));
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   |
      |                   void*
void realocare_memorie (student **vector, int dimensiune) {
    *vector = realloc(*vector, dimensiune * sizeof(student));
}
iamdhavalparmar
  • 981
  • 5
  • 20

1 Answers1

7

You compiled your C code through a C++ compiler (g++ by the error message). This is the signature error of making that mistake. Invoke gcc instead.

Joshua
  • 38,744
  • 8
  • 68
  • 123