You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*(ptr_2 + i) = *ptr + 1; //accessing value at ptr 2 iteratively through the array, accesses value at ptr2 through the array cuz ptr2 itself points at first value
ptr++;
}
return ptr_2;
}
// main method here where passing in array
// in main method or whatever method is using fxn, make sure to free() memory
//int * ptr_2 = add_one(ptr, size);
//free(ptr_2);
//good practice to also set ptr_2 = NULL;
// dynamically allocating ptr_2 allows us to use the array result in different instances outside of the function itself