Question: 1) What address, in base 10, does Version 1 of the addValueAtIndex function assign value to? 2) What address, in base 10, does Version 2

 1) What address, in base 10, does Version 1 of the

1) What address, in base 10, does Version 1 of the addValueAtIndex function assign value to?

2) What address, in base 10, does Version 2 of the addValueAtIndex function assign value to?

Would you mind explaining your steps as well? Thank you!

The main function: int main() { int *ptr = malloc(10 + sizeof(int)); printf("main: &ptr: %lu ", (unsigned long)&ptr); printf("main: ptr: %lu ", (unsigned long)ptr); addValueAtIndex(&ptr, 789, 2); return 0; } Version 1 of addValue Atlndex: void addValueAtIndex(int **ptr, int value, int index) { *ptr[index] = value; } Version 2 of addValueAtindex: void addValueAtIndex(int **ptr, int value, int index) { (*ptr)[index] = value; } Output - addresses in base 10 - when the program is run (64-bit compile, run on a CSL server): main: &ptr: 140721326562184 main: ptr: 11968536

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!