I want 2, 4, 6 to display… instead I think address numbers are displaying?
What do I need to do to correct and why?
Thanks
(purpose… to demonstrate ability to change array space and still keep the base of the array)
int *line;
line = new int;
line[0] = 2;
line = new int;
line[1] = 4;
line = new int;
line[2] = 6;
line = new int;
printf("%d %d %d", line[0], line[1], line[2]);
Try this instead:
Points to notice:
Also take a look at this question in SO:
delete vs delete[] operators in C++