Hi,
I have really lame problem which is probably that easy, that I can't get it working. I have program like this below. And I need to make prototype to get it working. But I don't know how it need to look like. I don't want to have these functions before main, I need to have it it below like I'm showing here.
#include <stdio.h>
//Here I need my prototype
enum colours
{
BLUE, YELLOW, BROWN, BLACK, RED, KHAKI
};
int main()
{
calculate();
printf("%f %f %f\n", demo.a, demo.b, demo.c);
return 0;
}
typedef struct version
{
double a, b, c, d, book, edition;
} Work;
Work demo =
{
.a = 12.35, .b = 13.5, .c = 7.0, .book = YELLOW, .edition = BLUE
};
Work calculate()
{
//My calculation
return demo;
}
When I compile it I get these errors because this function is not declared yet. So please help me with making prototype of this function.
||=== ToDo, Debug ===|
main.c|6|warning: ISO C does not allow extra ';' outside of a function|
main.c||In function 'main':|
main.c|10|warning: implicit declaration of function 'calculate'|
main.c|11|error: 'demo' undeclared (first use in this function)|
main.c|11|error: (Each undeclared identifier is reported only once|
main.c|11|error: for each function it appears in.)|
main.c|12|error: expected ';' before 'return'|
main.c|22|error: expected '}' before ';' token|
||=== Build finished: 5 errors, 2 warnings ===|
Thanks. I am really embarressed for asking this type of question but I am just overseeing solution.