NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Function Prototypes
March 02, 2011 by snagle |
I have completed the LED Array project and everything is working as it should; however now I am trying to add some functionality to this application and it requires the addition of some new functions within the "ledarray.c" source file. I may be missing something, but for the life of me I can't find where the function calls are declared (i.e. where are the function prototypes?). I need to add some declarations for the new functions I have created, but I have looked through all of the header files (.h files) and I can't even find where the original functions are declared. Could someone please point me in the right direction. Like I said, I must be missing something. Thanks for the help. |
---|---|
March 03, 2011 by hevans (NerdKits Staff) |
Hi snagle, You can just add your new functions directly to ledarray.c. You only need to create .h files when you are going to be linking external files against your .c file. Since ledarray.c contains the main() method you don't need to declare the methods in any outside file. Humberto |
March 03, 2011 by snagle |
Humberto, Thanks allot for your help. If I understand you correctly, you are saying that it is unnecessary to declare functions within the file where "main()" exits (i.e. no need for a function prototype). Any new functions can just be written without a preceding declaration and they will just get defined implicity by the compiler? Thanks again for the help. Snagle |
March 04, 2011 by Rick_S |
The only time you would have to declare them is if you place the function below where it's called for example.
Would work without declaring however,
Would not without declaring before main. At least that's my experience. :) YMMV Rick |
Please log in to post a reply.
Did you know that you can turn a $20 digital scale into a live weight sensor using our kit with a few extra parts? Learn more...
|