I have two questions about the delete operator.
1.) Can I delete multiple variables with a single call to delete? What I mean is, can I do the following:
???Code:double *a, *b, *c; a = new double[10]; b = new double[10]; c = new double[10]; delete [] a, b, c;
2.) Is it ever ok to ommit the delete operator? For instance, if I have a function that created some dynamically allocated objects, and that functions is about to return, should my program end with the following:
Or could I ommit the delete oporator and end the function merely by coding:Code:delete [] a; delete [] b; delete [] c; return 0; }
???Code:return 0; }