//Revision Lecture 17: Sample Q1 //Sasha Vassar Week10 //Print out the total of the number of steps taken in a specific direction. So //for example, if direction is 'l', find all the structs with direction as 'l' //and add them numbers in those structs up. Edit the function: //int total(int size, struct direction array[MAX]) #include #define MAX 50 struct direction { char direction; int number; }; //TODO: Edit the function total() int total (int size, struct direction array[MAX]) { int sum = 0; return sum; } //DON'T MODIFY THE MAIN - IT IS HERE TO TEST THE FUNCTION ONLY int main(void){ struct direction test_array[MAX] = { { .direction = 'l', .number = 30}, { .direction = 'l', .number = 25}, { .direction = 'r', .number = 15} }; printf ("The total movement in 'l' direction was %d\n", total(3, test_array)); return 0; }