#include <stdio.h>
#include <limits.h>
struct Test {
float book_price;
int book_tax;
};
int max(int mx, int tmp) {
if (mx > tmp)
return mx;
return tmp;
}
int find_max(struct Test arr[], int len) {
int mx = INT_MIN;
for (int i = 0; i < len; i++) {
int tmp = arr[i].book_price + arr[i].book_tax;
mx = max(mx, tmp);
}
return mx;
}
int main()
{
struct Test arr[] = {
{ 4, 6 },
{ 1, 7 },
{ 11, 5 },
{ 8, 6 },
{ 2, 3 },
{ 7, 5 }
};
int result = find_max(arr, sizeof arr / sizeof arr[0]);
printf("%i", result);
return 0;
}
/*
run:
16
*/