MPLAB MCC18 C tutorial EN
Short Description
MPLAB MCC18 C-PROGRAMMING TUTORIAL. M.F. van Lieshout. TU/e, fac. ID. Or. 14-09-2005. Transl. … There are some basic rules when programming in C: …
Website: w3.id.tue.nl | Filesize: 20kb
Content
MPLAB MCC18 C-PROGRAMMING TUTORIAL
M.F. van Lieshout
TU/e, fac. ID
Or. 14-09-2005
Transl. 17-05-2006Basic rules for programming in C
There are some basic rules when programming in C:
- Comments for only 1 line of code start with 2 slashes: //
//This is a comment
Add many comments to your code, otherwise it is very hard to remember how
your program works after a few weeks!
- Comments for more than 1 line start with /* en end with */
/*
This is a comment.
This is another comment.
*/
- At the end of each line with some instruction, a semi-colon (;) has to be
placed.
a=a+3;
- Parts of the program that belong together (functions, statements, etc.), are
between { and }.
void main(void) //Function
{
//Add code
}
The structure of the program
The structure of a program in C is as follows:
- Add libraries with functions.
This is done with the following line of code:
#include
- Declare (global) variables.
The different types of variables will be discussed later in this document.
- Making prototypes of the functions.
A prototype of a function ensures that the function can be called anywhere in
the program. Without…
Get the file Download here
Related Books:Related Searches: fac id, types of variables, global variables, semi colon, void function
Comments
Leave a Reply