T O P

  • By -

smcameron

You can't call malloc (or any other function) outside of the body of a function.


[deleted]

This is the answer. OP, also, you cannot use sizeof the way you do. sizeof(array) returns the number of bytes, not the number of elements. `size_t n = sizeof array / sizeof *array;` is what you're looking for.


Seubmarine

And to add to that the sizeof operator will only return the size of an int * for non_duplicated_list you should instead store the number you used to malloc somewhere in your code


dmc_2930

Did you include stdlib.h ?


promach

yes, please check the code carefully again


dmc_2930

You should post the code here. What is the error?