Hello Earnest,
ernestsnaith wrote:
I app ologise for how basic these questions are but am i understanding 'Switch' correctly? I have a number 0-10 in Thno, should it branch to corresponding ToothX?
switch (Thno) {
case 0: Error(); break;
case 1: Tooth1(); break;
case 2: Tooth2(); break;
case 3: Tooth3(); break;
case 4: Tooth4(); break;
case 5: Tooth5(); break;
case 6: Tooth6(); break;
case 7: Tooth7(); break;
case 8: Tooth8(); break;
case 9: Tooth9(); break;
case 10: Error(); break;
}
This is what first put me off switch, I have lots of error such as
implicit parameter declaration for tooth1
Suggest you remove the case 0: and case 10: switch statements, and make the final switch statement -
default: Error();
as Peg suggested. This will pick up any value ot Thno other than 1 through 9.
Each function that is called will need to have a prototype declared prior to its first use. I suspect this may be the reason for your compile errors. The prototypes might take the form -
void Tooth1(void);
void Tooth2(void);
etc.
Normally these would be part of a header file, and the header file included near the beginning of the main file.
Regards,
Mac