In a program when we declare 1 array and one variable. Then the address of variable will be next to to the array or not | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In a program when we declare 1 array and one variable. Then the address of variable will be next to to the array or not

10th Apr 2020, 1:48 PM
User..
User.. - avatar
4 Answers
+ 1
It is up to the computer. It allocates available place for your variables on its own.
10th Apr 2020, 1:52 PM
Mustafa K.
Mustafa K. - avatar
+ 1
Already, when declaring array, you need to specify the amount. For example: int arr[4]; int x; the address of x might be after the fourth element or before the first element or somewhere else. This is up to computer. edit: in fact, you can try it out and see how computer allocates places.
10th Apr 2020, 1:56 PM
Mustafa K.
Mustafa K. - avatar
+ 1
Tq Mustafa
10th Apr 2020, 1:58 PM
User..
User.. - avatar
0
But in array it is consecutive know
10th Apr 2020, 1:53 PM
User..
User.. - avatar