Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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: 11968536Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started