#include #include struct direction { int number; char dir; }; // Return the total number of left steps 'l' int struct_count(int size, struct direction array[size]) { // TODO: Complete this function. int count = 0; for (int i = 0; i < size; i++) { if (array[i].dir == 'l') { count = count + array[i].number; } } return count; } // This is a simple main function which could be used // to test your struct_count function. // It will not be marked. // Only your struct_count function will be marked. #define TEST_ARRAY_SIZE 5 int main(void) { struct direction test_array[TEST_ARRAY_SIZE] = { { .number = 3, .dir = 'l'}, { .number = 5, .dir = 'l'}, { .number = 2, .dir = 'u'}, { .number = 13, .dir = 'd'}, { .number = 30, .dir = 'u'} }; printf("%d\n", struct_count(TEST_ARRAY_SIZE, test_array)); return 0; }