/ ************************************************************************
*
* Purpose: Program to demonstrate functions.
* Author: M J Leslie.
* Date: 28-Feb-94
*
************************************************************************/
int add( int, int); /* Function declaration */
main()
{
int i=1;
printf("i starts out life as %d.", i);
i = add(1, 1); /* Function call */
printf(" And becomes %d after function is executed.\n", i);
}
/************************************************************************/
int add( int a, int b) /* Function definition */
{
int c;
c = a + b;
return c;
}
| file: /Techref/language/ccpp/cref/EXAMPLES/function.c, 0KB, , updated: 1997/4/21 08:52, local time: 2012/2/9 22:14,
38.107.179.231:LOG IN |
| ©2012 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.piclist.com/techref/language/ccpp/cref/EXAMPLES/function.c"> language ccpp cref EXAMPLES function</A> |
| Did you find what you needed? |
|
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
Robotics nuts!Check out http://users.frii.com/dlc/robotics/projects/botproj.htm from Dennis Clark. This guy ROCKS! He has made (and sells but also releases code, docs, etc...) for a number of cool little robotic modules including whiskers, IR proximity detect and remote control, Sonar proximity detect, PWM, Servo, compass. Most of these use the little PIC 12C508 controller which costs basically nothing and is soooo tiny.The 4 servos, 2400 baud serial servo controller is a wonder of magic and he sells the programmed chip for $8. Wow! |
.