pointers
Deleting a pointer
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)?[详细]
2023-04-09 18:52 分类:问答C++ std::list of pointer to a struct
I believe it\'s a very easy question but I\'m quite confused. What I am d开发者_运维问答oing wrong ?:[详细]
2023-04-09 18:44 分类:问答What's the use of pointer-casting a dereferenced pointer?
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[详细]
2023-04-09 16:36 分类:问答Choosing between reference (T&) and const pointer (T* const)
Is there any reasonable use case, where one should use const pointer over reference? T obj; T &r = obj;// style-1[详细]
2023-04-09 16:03 分类:问答Is creating a reference to a nonexistant array item undefined behavior?
With my compiler at least, creating a reference implies no dereferencing. Therefore, code like the following works:[详细]
2023-04-09 15:52 分类:问答Initializing array of pointers
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[详细]
2023-04-09 13:14 分类:问答Simple C pointer issue
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[详细]
2023-04-09 12:06 分类:问答Do I have to free memory from every initialized string?
// loads a file into memory void load_file() { char *data = \"This is so data\"; printf(\"function: %s\\n\", data);[详细]
2023-04-09 11:34 分类:问答Pointer to Array of Strings Is Fine in Function but not outside
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[详细]
2023-04-09 09:45 分类:问答How to use a pointer's methods in C++?
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[详细]
2023-04-09 09:36 分类:问答