Questions tagged [pointer-address]

27 questions
13
votes
5 answers

delphi pointer address

In Delphi: How do I get the address (0x2384293) a pointer points to? var iValue := Integer; iptrValue := PInteger; implementation procedure TForm1.Button1Click(Sender: TObject); begin iptrValue := @iValue; iValue := 32342; //Should…
Acron
  • 1,378
  • 3
  • 20
  • 32
8
votes
3 answers

Goto a specific Address in C

How can I JMP to a specific address in C? I want to use goto 0x10080000 This is not working, is there other way I can change the address of Program Counter??
Rgarg
  • 496
  • 3
  • 6
  • 13
7
votes
2 answers

Getting the address of a pointer

My apologies, I know there are a million questions on pointers, arrays etc. although as basic as this is I just can't seem to find anything pointing (ha ha!) to an answer. I've got a pointer that is initialised to point to a chunk of memory, I…
R4D4
  • 1,382
  • 2
  • 13
  • 34
6
votes
5 answers

Is the order of memory addresses of successively declared variables always descending?

why does the hexadecimal value of pointer address returned is always in decreasing order? for example here int a was declared before int d, so it's address always comes out to be greater than d, and same for &b,&e and &c,&f, I want to know that is…
Ashwini Chaudhary
  • 244,495
  • 58
  • 464
  • 504
2
votes
2 answers

CS50 recover, when to use buffer and &buffer?

I am solved the pset4 recover in the CS50. Although I solved the problem, I am confuse between "buffer" & "&buffer". Please pay attention to "LINE AAAAA" & "LINE BBBBB". #include #include #include // New type to…
Consxious
  • 53
  • 6
2
votes
1 answer

iOS: Setting properties

When I'm setting a property with an object that is currently in a retained NSArray, will it only store the pointer (light-weight), or will it copy the contents to the property? From what I know, it seems like it would only assign the pointer, but…
RileyE
  • 10,874
  • 13
  • 63
  • 106
1
vote
3 answers

How are the addresses given to pointer variables? Do they follow any pattern?

#include int main() { char ch, *p1, **p2, ***p3, ****p4; ch='a'; p1=&ch; printf("%c %d %c\n", ch, p1, *p1); p2=&p1; printf("%d %d %c\n", p2, *p2, **p2); p3=&p2; printf("%d %d %d %c\n", p3, *p3, **p3, ***p3); …
user9749684
1
vote
1 answer

Difference between void* and char*

char srch(char x[],char k){ int i=0; while(x[i]!='\0') { if(k==x[i]) { const char *h=&(x[i]); const void *l = h; cout<<"\n\nTHE CHARACTER "<
Tarun Bisht
  • 121
  • 13
1
vote
1 answer

Add an adress to an array of pointers C

I have to write a function that will add an adress at the end of an array of pointers. Here is what I've done. I want to know if I did right and if not, please correct me. #include #include #define MAX 3 void add( int…
1
vote
1 answer

How to get address to use reflect field?

I got address of a.two. I want to get same address to use reflect field. package main import ( "fmt" "reflect" ) type A struct { one int two int three int } func main() { a := &A{1, 2, 3} fmt.Println(&a.two) …
Ken
  • 15
  • 3
1
vote
2 answers

Weird Pointer Address for Individual Struct Data Member

I observe some weird behavior today , the code is as follow : The Code : #include struct text { char c; }; int main(void) { text experim = {'b'}; char * Cptr = &(experim.c); std::cout << "The Value \t: " << *Cptr <<…
caramel1995
  • 2,968
  • 10
  • 44
  • 57
1
vote
3 answers

Assigning a pointer in a struct to a variable

This program is supposed to create a dynamic memory vector. I'm pretty sure I'm using malloc correctly. My real problem is some syntax with pointers, particularly a pointer inside a struct. I'm trying to access the address of an int pointer inside…
PilHliP
  • 21
  • 1
  • 1
  • 4
1
vote
5 answers

How can pointer addresses have different lengths?

I just executed this code example: int *i = (int*) malloc( sizeof(int) ); printf( "%p, %p\n", &i , i ); and this is what I got: 0x7fff38fed6a8, 0x10f7010 So I wonder why is the second address shorter than the first one?
math
  • 8,514
  • 10
  • 53
  • 61
0
votes
2 answers

Wanting to truncate address for clarity not working as expected

Wanting to truncate addresses for clarity. Not looking for improved code, just why the hex code subtraction does't seem to work properly. First result with 'zero' being subtracted from 'cname' and 'arptr': address of 'cname' is 0x7fff5fbff720 and…
Joel
  • 197
  • 1
  • 10
0
votes
3 answers

Changing pointer address - function

I have problem with pointers. This is working fine - int main(void){ char *w; w = calloc(20, sizeof(char)); w = "ab"; printf("%c",*w); w = w + sizeof(char); printf("%c",*w); return 0; } but if i use function…
kejmil01
  • 95
  • 2
  • 7
1
2