user7110415
user7110415

Reputation:

Is an array address random or fixed?

typedef int zip_dig[5];
zip_dig cmu = { 1, 5, 2, 1, 3 };

Let's say we run this program for the first time, and cmu's address is 20 in the stack. When we run this program again, is cmu's address still 20 in the stack, or a different number? If they are different addresses, what makes them different: the compiler or operating systems?

Upvotes: 1

Views: 68

Answers (1)

ProgM
ProgM

Reputation: 41

Most modern operating systems supports some kind of ASLR (Address Space Layout Randomization) which is randomization of the addresses of the stack, loading address and more. Google ASLR if you want more detailed answer.

Upvotes: 3

Related Questions