Skip to main content

Questions tagged [pointers]

A pointer is a data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address.

Filter by
Sorted by
Tagged with
2 votes
3 answers
186 views

Say I have the following header #ifndef WINDOW_HPP #define WINDOW_HPP // includes... namespace window { struct Window { GLFWwindow *handle = nullptr; }; struct ...
user avatar
1 vote
7 answers
436 views

Most weakly typed languages do not have a concept of a pointer. Instead, most of them use references. However, is it possible to introduce pointers to such a language. From a naive point of view, to ...
Lily White's user avatar
0 votes
1 answer
84 views

I have the following code in C that reads data off a char array and makes decisions on what variables should some pointers point to. char preset1[20]; char preset1Name[20]; int preset1Temp; int ...
HFOrangefish's user avatar
4 votes
2 answers
2k views

When I started programming, I learned what Pointers are in C++. In Java, references are variables which hold the address of an object. So conceptually it's a pointer, without the ability to directly ...
tweekz's user avatar
  • 237
0 votes
1 answer
428 views

As per Robert C. Martin in Clean Architecture, he gives a simple UML diagram to illustrate Dependency Inversion. To put it simply, HL1 initially referred to ML1 without interface to invoke F() ...
Andy Lin's user avatar
  • 185
1 vote
4 answers
12k views

I started to write a function which had a pointer to a vector as a parameter so that it could modify that vector to output results (as the actual return value was an error code), when I started to ...
I_like_robots's user avatar
0 votes
1 answer
137 views

Suppose I have a program.c that needs element_123 to do some operations, and element_123 can be accessed by including agent.h /*program.c*/ #include "agent.h" uint32_t element_123 = 0; ...
Andy Lin's user avatar
  • 185
11 votes
3 answers
3k views

I'm writing in C++, but this problem applies to any language without GC and even to languages with a GC as well. I have a structure in memory in which I create/add objects. The structure takes ...
Helloer's user avatar
  • 293
-2 votes
2 answers
202 views

I'm pretty new with C so I have encountered many doubts with pointers. I've already search a lot about this but there are some things that still are not clear for me, and I also think this will help ...
Nicolas Bazan's user avatar
1 vote
2 answers
2k views

I was in #Qt irc channel, and I showed a small snippet of my code in a style that I heavily rely upon. It looks like this: /* Get Reply from Server */ QPointer<QNetworkReply> reply; { ...
Anon's user avatar
  • 3,649
5 votes
1 answer
7k views

Why do we need to specify the type of the data whose address, a pointer will hold, if all pointers are the same. Since all pointers store addresses. Also, the amount of space a pointer will require in ...
amd's user avatar
  • 59
0 votes
2 answers
2k views

Consider the following constructor: NetworkTools::NetworkTools(QObject *parent) : QObject(parent) { view = new QWebEngineView(); view->setParent(parent); // Produces an error, shown below. ...
Anon's user avatar
  • 3,649
1 vote
2 answers
327 views

I've been modifying some code written by a previous employee and came across a function with the following signature: BOOL WINAPI PrependPadding( _In_ SIZE_T cbPadding, _In_ SIZE_T cbRow, ...
Govind Parmar's user avatar
-1 votes
1 answer
2k views

I have written two small programs in which I declare a very small array. Then I try to access values out of bounds. The interesting thing I noticed that when I try to decrement the index I can ...
yoyo_fun's user avatar
  • 2,297
1 vote
1 answer
156 views

UncommentatedPannen's (pannenkoek2012) newest video describes a glitch in the Nintendo 64 game Super Mario 64, which allows an object to push Mario out of bounds, which isn't normally possible, by ...
0xFFF1's user avatar
  • 165
4 votes
1 answer
2k views

A common way to implement "PIMPL" in C is to do this: typedef struct _Opaque Opaque; Opaque* createOpaque(); void doSomething(Opaque *opaque); Or: typedef struct _Opaque* Opaque; Opaque ...
user112513312's user avatar
-1 votes
1 answer
596 views

In GO, rule is, methods can be defined only on named type and pointer to named type. In C, below code, operations are defined on type(say List), typedef struct List List; //list.h typedef struct { ...
overexchange's user avatar
  • 2,315
1 vote
1 answer
65 views

I'm creating an HTML5 game using javascript and have got some problems during the first instantiation of the objects of the scene. Scenario Self-written 2d game engine that supports multiple types ...
user avatar
2 votes
5 answers
2k views

I know that long time ago computer scientists decided to treat all pointers to memory cell of address 0 as NULL. However, the memory cell at that address does exists after all, right? In that case, ...
alagris's user avatar
  • 139
8 votes
6 answers
5k views

In my day to day programming, I tend to use very few pointers, not only because I want to keep my code simple and error free, but because I assume that the programming that I do does not have any ...
Anon's user avatar
  • 3,649
9 votes
6 answers
2k views

In C, * is called the indirection operator or the dereference operator. I understand how it works when it is used in a statement. It makes sense to write *p or * p, considering that it is a unary ...
Torm's user avatar
  • 151
1 vote
2 answers
1k views

I am trying to understand the ideas of pointers and references in C++. I am stuck with the following, what would be the specific behaviour in this case? I have a class like this: class MyClass{ ...
Vlad's user avatar
  • 137
1 vote
1 answer
228 views

I am on a micro controller (which means I can only have static memory allocation) and I am trying to work with inheritance..... Suppose I have a abstract class Image and an abstract class Font. An ...
DarthRubik's user avatar
4 votes
4 answers
1k views

In C++ I frequently see these two signatures used seemingly interchangeably: void fill_array(Array<Type>* array_to_fill); Array<Type>* filled_array(); I imagine there is a subtle ...
calben's user avatar
  • 611
3 votes
2 answers
4k views

I have been learning C++ recently, and upon reading up on pointers I had a moment of thought. I'm still attempting to grasp the very idea of pointers so excuse me if this doesn't make sense beyond ...
downrep_nation's user avatar