Questions tagged [pointer-address]
27 questions
0
votes
4 answers
logic of pointers
I got the idea of pointers' logic generally, but there is an unclear point for me that is related to the piece of code underlain.
#include
using namespace std;
int main ()
{
int first = 50,
second = 150;
int * p1, * p2;
p1 =…

El3ctr0n1c4
- 400
- 2
- 7
- 18
0
votes
2 answers
C++ Object references in loop
Possible Duplicate:
C++ Object references in loop cycle
I'm trying to create different objects of the same type using a loop, and then storing a pointer to each specific object in a linked list.
The problem is, each time an object is…

user1019880
- 41
- 3
0
votes
8 answers
Pointer address does not change in a link list
My problem is q->next always prints the same address, but I assigned q = &x;. Why it is not printing different addresses?
#include
class Node
{
public:
int val;
Node *next;
Node(int v,Node *p) { val=v, next=p; }
};
int…

russell
- 3,668
- 9
- 43
- 56
0
votes
1 answer
How to return the address of inner struct given pointer to outter struct in c
How can I return the address of the target if i have the following struct and the prototype for the function is also as follows
struct inner{
int foo;
};
struct outter{
struct inner innerStruct[100];
};
struct inner * foo1(int…

python_newbie
- 1
- 1
0
votes
5 answers
Manually set pointer value
i'm working in C.
What I'm trying to do is a function that will return an int containing an address pointing to an object. Then, use the int I received (containing the address), and build a pointer pointing to this address.
Example :
MyClass* obj =…

Phil-R
- 2,193
- 18
- 21
0
votes
5 answers
What is the correct way to print the address of a variable already deallocated from the heap?
I'm making a logging utility that tracks allocations and deallocations inside a library I made.
My program didn't crash but I'm still skeptical about my approach.
void my_free(struct my_type *heap)
{
if (!heap)
logger("Fatal error: %s",…

LeoVen
- 632
- 8
- 18
0
votes
1 answer
Why pointer is giving two different addresses?
I have this program. And I have some doubts. You can run it in your compiler. I am using gcc compiler in linux
#include
int main()
{
int j=4,*add;
int i=2;
int a[i][j];
for (i=0;i<=1;i++)
{
for(j=0;j<=3;j++)
…

Ashish Tomer
- 55
- 1
- 8
0
votes
1 answer
Problems with 64 bit pointers
I am using Windows 7 and have a 64 bit and a 32 bit version of my program. The 32 bit version works perfectly fine, however, I am having issues with the 64 bit version at runtime. I have a list view item created and am filling the columns with my…

js7289
- 1
- 1
0
votes
2 answers
GetProcAddress weird return address
Someone explain why the next code returns a pointer inside ntdll.dll?
GetProcAddress(LoadLibraryA("kernel32.dll"), "EncodePointer");
GetProcAddress(LoadLibraryA("kernel32.dll"), "DecodePointer");
PS: If call the function pointed by kernel32's…

greenboxal
- 469
- 3
- 16
0
votes
3 answers
Pointer (address) with if statement
I had a working code that gave me the address of a mesh (if i'm correct):
MyMesh &mesh = glWidget->mesh();
Now I want if thingie to assign different mesh adresses. One is mesh() first function and another function mesh(int): How is this done?
…

pazduha
- 147
- 3
- 17
-3
votes
1 answer
What is the memory address and pointer address in the following image?
I was just playing with pointer. And I understood only line 5, 6 and 10, 11 completely.
What I want to know is which one is the address of pointer here? And what does line 7 and 14 implies? Additionally what is the meaning of %p, using this code as…

Ratna Prakash
- 3
- 2
-8
votes
1 answer
Pointer and address in C
My teacher has these question on his lecture powerpoint but no answer. Can someone help. new to c.
If a is an int variable, is it always true that *&a == a ?
If p is an int* variable, is it always true that p == &*p ?
Is it ever meaningful to say…

momento
- 3
- 3