A pointer is a data type that "points to" another value stored in memory using its address.
0
votes
2answers
41 views
Qt, Dynamic allocation of memory
I have a little question: I made a little program where every time the user click on a QPushButon a new object is created with his pointer, here is my code:
ajoute *az = new ajoute;
QVBoxLayout ...
0
votes
5answers
57 views
placement of unary operator when using pointers in C
I am trying to learn about pointers in C, and don't understand why the unary * operator was appended to the end of the word "node" in the following code snippet:
struct node* CopyList(struct node* ...
-5
votes
2answers
42 views
Changing original pointer inside function [on hold]
Say I have this code:
int * p = 7;
f(p);
printf(p);
write function f so that line 3 will print 0.
I wanted to just say p=0 but i dont think that the address inside the function will be the same as ...
0
votes
0answers
23 views
event manager pass variable reference C#
I need to pass a reference variable into a function (the variable will be null when passing which is why a pointer is needed)
class Screen
{
EventMan eventman = new EventMan();
...
0
votes
0answers
11 views
JNA passing pointer ByReference
I'm calling a function from a DLL, using JNA, which needs an unsigned *short input argument
unsigned void my_function(unsigned long handle, unsigned short * serial);
I tried to pass serial as a ...
0
votes
2answers
51 views
incrementing pointers correctly?
I was using a char* array to copy parts of a string into another char* array, and I was wonder if doing this
do {
*pntr1++ = *pntr2++
} while (*pntr2 != '\0');
is the same thing as
do
...
2
votes
2answers
53 views
char pointer to pointer
I am trying to see to get around pointer to pointers. I am confused with this
int syntax_error(int num) {
cout << num << endl;
static char *err[] = {
"Cannot open\n",
...
-1
votes
4answers
129 views
Can we have operations between int* and unsigned int?
If I declare
int x = 5 ;
int* p = &x;
unsigned int y = 10 ;
cout << p+y ;
Is this a valid thing to do in C++, and if not, why?
It has no practical use, but is it possible?
3
votes
1answer
105 views
C++ Integer to pointer conversion
So recently I've been dealing with WinAPI's WriteProcessMemory and ReadProcessMemory which both take LPVOID as their second argument which is the actual address in the memory of another process we ...
2
votes
2answers
45 views
Passing an array pointer for placing in a hashmap in C++
I'm kinda new to C++ (coming from C#).
I'd like to pass an array of data to a function (as a pointer).
void someFunc(byte *data)
{
// add this data to a hashmap.
Hashtable.put(key, data)
}
...
0
votes
0answers
11 views
Pointers to functions that return a pointer inside a class
I need to implement a pointer to a function that returns a pointer. That should be easy, like:
typedef int* (*ptrInt)(const int);
ptrInt ptFunc;
And then,
int* foo(const int a) {
int* b = new ...
-12
votes
3answers
132 views
How are pointers stored in memory?
I'm a little confused about this.
On my system, if I do this:
printf("%d", sizeof(int*));
this will just yield 4. Now, the same happens for sizeof(int). Conclusion: if both integers and pointers ...
-2
votes
2answers
53 views
starting address of integer array pointing to itself? [duplicate]
The output of the programmer :
#include<stdio.h>
int main (){
int A[3] = {1,2,3};
printf("%u %u %u ",&A,A,*A);
return 0;
}
is :3216303812 3216303812 1
here &A and A is same that ...
2
votes
2answers
30 views
How can I make a Ruby symbol pointer point to something else instead?
I'm pretty sure this is impossible, but it's awfully tempting.
I'm working with tree structures, made of hashes within arrays within hashes, et cetera. The hierarchy bottoms out in symbols (i. e., ...
4
votes
7answers
123 views
Why should I use double pointer variable to receive another pointer's address(&ptr1)
int num = 45,*ptr1,*ptr2;
ptr1=#
ptr2=&ptr1;
printf("%d\n",*ptr1);
I've been thinking about this question for a while,but couldn't find a way to understand it,why ...