Create a function int findMax(int* arr, int size) that returns the largest element. Use pointer arithmetic to traverse the array. Start by assuming the first element is the maximum, then compare each subsequent element.
You'll need: int max = *arr to initialize, then a loop that compares *ptr > max and updates max when you find a larger value. Increment ptr after each comparison. Test your function with arrays containing negative numbers too.
The function should work correctly whether the maximum is positive, negative, or zero. This reinforces pointer dereferencing and traversal patterns.