In C++, whats the recommended way of deleting a pointer? For example, in the following case, do I need all three lines to delete the pointer safely (and if so, what do they do)?
I believe it\'s a very easy question but I\'m quite confused. What I am d开发者_运维问答oing wrong ?:
This question is about code explanation, not code debugging. The code I\'m using works. I\'m using a public code and I was curious to look at one of their \"grow array\" template, which looks like thi
Is there any reasonable use case, where one should use const pointer over reference? T obj; T &r = obj;// style-1
With my compiler at least, creating a reference implies no dereferencing. Therefore, code like the following works:
I have a Deck object (deck of cards) which is a double-ended queue implemented as a doubly-linked list.I would like to be able to shuffle the queue at will, but the way I would go about it is beyond m
It\'s been a long (long...) time since I\'ve done any C programming and I\'m stuck on what should be a really simple issue. I have a simple function that\'s calling another function that is allocating
// loads a file into memory void load_file() { char *data = \"This is so data\"; printf(\"function: %s\\n\", data);
I\'m working with PCRE library for C on a linux x86_64 system, though I don\'t think the PCRE is to blame for the issue I\'m having. Basically I have an array of character arrays that holds the result
I have a code in which I use a pointer to a class that I made. As an example lets say I have a Person method, and each Person had a name. Now lets say I use a pointer for a person like