SLIDE 1
int nums[SIZE]; int i; for (i = 0; i < SIZE; i++) { nums[i] = i - - PowerPoint PPT Presentation
int nums[SIZE]; int i; for (i = 0; i < SIZE; i++) { nums[i] = i - - PowerPoint PPT Presentation
int SIZE = 4; int nums[SIZE]; int i; for (i = 0; i < SIZE; i++) { nums[i] = i * i; } list = *1, spam, 4, U+ list.insert (2, soup) list.remove (spam) length = len(list) int
SLIDE 2
SLIDE 3
int SIZE = 4; int nums[SIZE]; int i; for (i = 0; i < SIZE; i++) { nums[i] = i * i; }
SLIDE 4
SLIDE 5
list = *1, “spam”, 4, “U”+ list.insert(2, “soup”) list.remove(“spam”) length = len(list)
SLIDE 6
int main() { int SIZE = 7; int a[] = {16, 5, 23, 19, 42, 17, 12}; int evens = countEvens(a, SIZE); printf("The number of even numbers is %d.\n", evens); return 0; }
SLIDE 7
int main() { int SIZE = 7; int a[] = {16, 5, 23, 19, 42, 17, 12}; int evens = countEvens(a, SIZE); printf("The number of even numbers is %d.\n", evens); return 0; } int countEvens(int nums[], int size) { // Returns the count of even numbers in the nums array. … return count; }
SLIDE 8
SLIDE 9
int countEvens(int nums[], int size) { int count, i; count = 0; for (i = 0; i < size; i++) { if (nums[i] % 2 == 0) { count++; } } return count; } int countEvens(int* nums, int size)
SLIDE 10
- –
SLIDE 11