The tests of this exercise fail due to implicit declaration in them. Can someone help?
Share your resistor_color.h
and resistor_color.c
code please.
Here’s the header file
#ifndef RESISTOR_COLOR_H
#define RESISTOR_COLOR_H
typedef enum {
BLACK,
BROWN,
RED,
ORANGE,
YELLOW,
GREEN,
BLUE,
VIOLET,
GREY,
WHITE
} resistor_band_t;
#endif
And the .c
#include "resistor_color.h"
int color_code(resistor_band_t color);
resistor_band_t *colors();
int color_code(resistor_band_t color){
return color;
}
resistor_band_t *colors(){
static resistor_band_t color_list[10];
for (resistor_band_t keyword = BLACK; keyword <= WHITE; keyword++){
color_list[keyword] = keyword;
}
return color_list;
}
Thanks!
Could you share what fails?
Note your header doesn’t declare any functions. The header needs to declare the functions for the tests to use them.
That was the problem! I passed other exercises without declaring functions in the header file, they were already there… Thank you!
2 Likes