pointers Questions

2

Solved

I have a pointer to an array element which is used as an argument in a function and is moved along the array inside said function via the "++" operation. I would like the updated position...
Encourage asked 21/3 at 21:25

3

I have a type: struct Foo { memberA: Bar, memberB: Baz, } and a pointer which I know is a pointer to memberB in Foo: p: *const Baz What is the correct way to get a new pointer p: *const Foo...
Contexture asked 7/8, 2016 at 23:40

8

Solved

I get this message when compiling C++ on gcc 4.3 error: ‘NULL’ was not declared in this scope It appears and disappears and I don't know why. Why? Thanks.
Vicissitude asked 20/1, 2009 at 17:5

7

Solved

In a system where registered objects must have unique names, I want to use/include the object's this pointer in the name. I want the simplest way to create ??? where: std::string name = ???(this);...
Caper asked 21/10, 2011 at 13:31

13

Solved

How do I understand following complicated declarations? char (*(*f())[])(); char (*(*X[3])())[5]; void (*f)(int,void (*)()); char far *far *ptr; typedef void (*pfun)(int,float); int **(*f)(i...
Olshausen asked 19/9, 2009 at 16:8

3

Solved

How do I declare a pointer to a character array in C?
Bushnell asked 19/3, 2012 at 23:30

7

Solved

The following line (pure c) compiles cleanly on windows (win7 64 bits + codeblocks 13 + mingw32) and debian (wheezy 32 bits + codeblocks 10 + gcc) but raises warning on kali (64 bits + codeblocks +...
Snoop asked 7/11, 2014 at 16:14

6

Solved

I defined a linked list in C++. I am trying to set a NULL value to the variable head (in the constructor of Movie_LinkedList), but I got: movie.h(40): error C2065: 'NULL' : undeclared identifier pl...
Brainless asked 21/3, 2013 at 14:9

3

Solved

#include <iostream> #include <memory> // unique_ptr using namespace std; int main() { std::unique_ptr<char*> char_ptr; char_ptr = (char*)"anisha"; return 0; } I want to as...
Decamp asked 27/11, 2018 at 6:44

6

Is there a way to "convert" a reference to pointer in c++? In example below, func2 has already defined prototype and I can't change it, but func is my API, and I'd like to either pass both paramete...
Photoemission asked 26/9, 2013 at 15:31

4

Solved

It is very unclear for me in which case I would want to use a value receiver instead of always using a pointer receiver. To recap from the docs: type T struct { a int } func (tv T) Mv(a int) int {...
Mackenziemackerel asked 5/1, 2015 at 7:54

6

Solved

What is uintptr_t and what can it be used for?
Proliferation asked 4/12, 2009 at 7:52

12

Solved

Recently I have come across this problem which I am unable to understand by myself. What do these three Expressions REALLY mean? *ptr++ *++ptr ++*ptr I have tried Ritchie. But unfortunately was un...
Braeunig asked 28/8, 2013 at 7:27

4

Solved

I'm using a vector of pointers to objects. These objects are derived from a base class, and are being dynamically allocated and stored. For example, I have something like: vector<Enemy*> En...
Bluepoint asked 1/9, 2009 at 7:58

2

I have the issue that I cannot properly close mmap-s in Python after I created a pointer to them. My use case is that I open files (usually that is UIO-devices to work with hardware, but the issue ...
Teague asked 16/11, 2018 at 14:38

3

Solved

I have a singly-linked-list, L, and create a pointer to this list P. It seems like sometimes modifying P changes the actual list, while other times modifying P does nothing to the actual list L and...
Furfur asked 8/11, 2019 at 1:53

5

Solved

As shown below, I want to pass a variable defined by char **x to a function as read only. A reference book shows linear search source code that executes linear search to a variable defined by int *...
Chartism asked 21/1 at 3:16

0

I am writing a C++ tagged pointer. I have a question about whether the operations I use to implement its basic functionality cause undefined behavior: When constructing a tagged pointer given a po...

2

Solved

I am trying to wrap my mind around pointers in Assembly. What exactly is the difference between: mov eax, ebx and mov [eax], ebx and when should dword ptr [eax] should be used? Also when I try to...
Nikolaos asked 3/5, 2017 at 20:31

6

Solved

I am learning C and am having trouble passing the pointer of a 2D array to another function that then prints the 2D array. Any help would be appreciated. int main( void ){ char array[50][50]; i...
Addend asked 23/5, 2013 at 21:40

2

Solved

I am learning about constexpr variables using the books listed here. In particular I read in C++ Primer that: Variables declared constexpr are implicitly const and must be initialized with constan...
Whitherward asked 15/10, 2022 at 15:12

15

How many pointers (*) are allowed in a single variable? Let's consider the following example. int a = 10; int *p = &a; Similarly we can have int **q = &p; int ***r = &q; and so o...
Carbonate asked 10/4, 2012 at 10:34

4

How can you interpret the following line of code? int (*arrayABC)[10]; In my textbook, it says that we have a pointer to a pointer to the 0th element of an integer array. However, I don't quite...
Civil asked 4/1, 2017 at 21:53

5

Solved

I have a struct type with a *int64 field. type SomeType struct { SomeField *int64 } At some point in my code, I want to declare a literal of this (say, when I know said value should be 0, or po...
Busload asked 8/6, 2015 at 18:21

30

Solved

Is there any way to determine (programatically, of course) if a given pointer is "valid"? Checking for NULL is easy, but what about things like 0x00001234? When trying to dereference this kind of p...
Tartuffery asked 15/2, 2009 at 15:45

© 2022 - 2024 — McMap. All rights reserved.