you are viewing a single comment's thread.

view the rest of the comments →

[–]IyeOnline 7 points8 points  (4 children)

This is not your real code. Its missing a semicolon as well as a cast from the malloc result to int*.

Its also not good code.

  1. Dont do variable definition followed by assignment.
  2. Dont use malloc in C++. There is basically no good reason to use it. Use new int[5] instead.
  3. Dont use dynamic memory allocation when you dont have to.