0

Changing the adresse of a pointer

int a[5] = {22, 33, 44, 55, 66}; int *ptr = NULL; ptr = a; /* point to the first array element */ printf("%d %x\n", *ptr, ptr); /* 22 */ ptr++; printf("%d %x\n", *ptr, ptr); /* 33 */ ptr += 3; printf("%d %x\n", *ptr, ptr); /* 66 */ ptr--; printf("%d %x\n", *ptr, ptr); /* 55 */ ptr -= 2; there are many app run in the computer (RAM) so is that normal, i mean we cant access variables of another app ?? bcuz i guess it's very dangerous to access another app variables.

24th Oct 2018, 7:17 AM
Kosai
2 ответов
0
No... Your program can access only to own process memory (simplifying all discussion) thanks to virtual memory See here https://en.m.wikipedia.org/wiki/Virtual_memory
24th Oct 2018, 11:21 AM
KrOW
KrOW - avatar
0
so we can say that if an app is using an adresse "0x01" and you called adresse in another app it will not be the same "0x01" it will be another adresse ""physically "" (_ that s what you are saying??_)
28th Oct 2018, 11:43 AM
Kosai