C Procedures
In C, a procedure is a function with return type void
/*Print n lines of stars; line i, for 1<= i <= n, has i stars on it */
void print_stars (int n) {
int j, k;
for (k= 1; k <= n; k++) {
/* Print line k, with k stars */
for (j= 1; j <= k; j++)
printf(�*�);
printf(�\n�);
}
}
Previous slide
Next slide
Back to first slide
View graphic version