about new

This is a discussion on about new within the C++ Programming forums, part of the General Programming Boards category; hello i cannot understand whats the benefit of saying that
Code:
int x=new int
rather saying
Code:
int x;
i ...

The first is a compile error.
Regardless, if you really meant a pointer, then the difference is that

- You aren't limited to stack space (~1 MB usually).
- The allocated storage won't be reclaimed as the function ends (extended lifetime; but comes with the disadvantage that you have to manually deallocate that).
- You can dynamically specify size (you can only specify the amount of storage to reserve on the stack with something that is known at compile time).