Deleting dynamically allocated memory

How would I delete a pointer to an int?

int* thing;

thing = new int;

Would I do delete[] thing or just delete thing?

I thought it was just delete thing because I thought it's not an array, so [] shouldn't be used. But then I came across a c-string defined as char* c and it seems a pointer can be treated as an array, since it was deleted with delete[] c. So I'm a little confused.

Thanks for any help!
Last edited on
If you new you delete, what you new[] you delete[].

Registered users can post here. Sign in or register to post.