Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Level 12 lesson 6 not getting exercise

#include <stdio.h>

struct mobile {
float screen_size; // in inch
int battery; // in mAH
int sim_count;
} mob;

void battery_check(struct mobile battery) {
if (battery.battery < 3000) {
printf("Poor battery backup");
} else if (battery.battery >= 3000) {
printf("Good battery backup");
}
}

int main() {
mob.battery = 4500;
battery_check(mob); // Passing the mob structure object to the battery_check function
return 0;
}
by

1 Answer

sam5epi0l
Use m instead of battery as provided in the code.


void battery_check(struct mobile m) {
if(m.battery < 3000) {
printf("Poor battery backup");
}
else if(m.battery > 3000) {
printf("Good battery backup");
}
}

Login / Signup to Answer the Question.