Presentation is loading. Please wait.

Presentation is loading. Please wait.

Announcements Homework #5 due Monday 1:30pm

Similar presentations


Presentation on theme: "Announcements Homework #5 due Monday 1:30pm"— Presentation transcript:

1 Announcements Homework #5 due Monday 1:30pm
submission instructions will be posted on Piazza GadgetsProduced should be 5,000,000 stop looping when temp goes above 100 Upcoming office hours: Tomorrow: Sheng 12-1:30pm Monday: Chris 11am-12pm 1 1 1 1 1

2 Schedule Last time: Loops and conditionals (chp. 13); Functions (sec ) Today: how functions work (sec. 12.5, 14.3) Monday: more on functions Next week: arrays, strings, pointers (chp. 16) 2 2 2 2 2

3 #include <stdio.h> #include <stdlib.h>
int power(int, int); main() { int a = 4, b = 7; int k = power(a, b); printf(“%d\n”, k); } int power(int x, int y) { int i, result; for (i = 0; i < y; i++) { result *= x; return result; 3 3

4 #include <stdio.h> #include <stdlib.h>
int power(int, int); main() { int a = 4, b = 7; int k = power(a, b); printf(“%d\n”, k); } int power(int x, int y) { int i, result; for (i = 0; i < y; i++) { result *= x; return result; Function declaration 4 4

5 #include <stdio.h> #include <stdlib.h>
int power(int, int); main() { int a = 4, b = 7; int k = power(a, b); printf(“%d\n”, k); } int power(int x, int y) { int i, result; for (i = 0; i < y; i++) { result *= x; return result; Function definition x and y are parameters 5 5

6 #include <stdio.h> #include <stdlib.h>
int power(int, int); main() { int a = 4, b = 7; int k = power(a, b); printf(“%d\n”, k); } int power(int x, int y) { int i, result; for (i = 0; i < y; i++) { result *= x; return result; Function call a and b are arguments 6 6


Download ppt "Announcements Homework #5 due Monday 1:30pm"

Similar presentations


Ads by Google