#include /** * Simple function to calculate the sum of an array * @param arr Pointer to the array * @param size Size of the array * @return Sum of array elements */ int array_sum(int* arr, int size) { int sum = 0; for (int i = 0; i < size; i++) { sum += arr[i]; } return sum; } /** * Function to find the maximum value in an array * @param arr Pointer to the array * @param size Size of the array * @return Maximum value in the array */ int find_max(int* arr, int size) { if (size <= 0) { return 0; } int max = arr[0]; for (int i = 1; i < size; i++) { if (arr[i] > max) { max = arr[i]; } } return max; } /** * Simple arithmetic operations function * @param a First operand * @param b Second operand * @return Result of a * b + a */ int arithmetic_ops(int a, int b) { int product = a * b; int result = product + a; return result; } /** * Pointer manipulation function * @param ptr Pointer to integer * @param value Value to set * @return The value that was set */ int pointer_ops(int* ptr, int value) { if (ptr != NULL) { *ptr = value; } return value; } int main() { int test_array[] = {1, 2, 3, 4, 5}; int size = 5; int sum = array_sum(test_array, size); int max = find_max(test_array, size); int result = arithmetic_ops(2, 3); int x = 0; pointer_ops(&x, 42); printf("Sum: %d, Max: %d, Result: %d, X: %d\n", sum, max, result, x); return 0; }