+ 1
Difference Between Creating Variables in Stack and Creating them in Heap, and Using Pointers in General
What is the difference and comparison between creating variables in the stack and creating variables in the heap? Also, what are the benefits of using pointers or not? Example: int i = 5; - VS - int ipval = 5; int *ip = &ipval; - VS - int ipval = 5; int *ip = new int; *ip = ipval;
4 ответов
+ 1
2nd & 3rd can give you address of ipval
+ 1
I know, but are there any functional differences? As in, is it faster or safer to use one or the other?
+ 1
Thanks!! Really useful article.