class_notes7

Stdioh int cube int y int main int i function

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: • Function definition format: return-value-type function-name( parameter list ); { declarations and statements } • Function body (block) – Variables can be defined inside blocks – Functions cannot be defined inside other functions Example Program: Custom Functions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 /* Creating and using custom functions */ #include <stdio.h> int cube( int y ); int main() { int i; /* function prototype */ /* counter */ /* calculate and print the cube of integers between 1 and 10 */ for ( i = 1 ; i <...
View Full Document

This note was uploaded on 08/06/2010 for the course ENGR 3 taught by Professor Ben-yaakov during the Summer '08 term at UCSB.

Ask a homework question - tutors are online