Find links to simple examples for understanding concepts like call-by-value, call-by-reference, use of global variables in functions, and others. Note that several examples on these also are in the course book and in the online book example programs available on the front page of the course web site through book resources.
Chapters
1-3 Examples on Algorithms/C programs and Six Problem Solving Steps
1. Write an algorithm for finding sum of 2 given integer numbers.
2. Write a C program for finding sum of 2 given integer numbers
3. Show the six problem solving steps for finding the sum of 2 given integer numbers.
Function Examples (Chapter 4)
1. Find Sum of 2 given numbers using one function with only call-by-value parameters.
3. Find Sum of 2 given numbers using one function with only global variables.
Nested if logic and switch_case Examples
(Chapter 6)
Problem is: Given grades of 4 tests for a student, write a program that uses appropriate nested if instruction or switch_case instruction to print the grade earned by the student where grade is A if average is 90 or above, B if average is 80-89, C if average is 70-79, D if averages 60-69 and F if average lower than 60.
1. Positive if logic solution from top of condition_action table.
2. Postive if logic solution from bottom of condition_action table.
3. Negative if logic solution from top of condition_action table.
4. Negative if logic solution from the bottom of condition_action table.
5. The swich_case solution for the same problem above.
Repetition Examples (Chapter 7)
5. for loop solution for problem 2 above: Find the class average of 10 students’ quiz marks.
Arrays Data Structure (Chapter 8)
1.
Find
the average of 5 given marks with a one dimensional array.
2.
Find
the average of 5 given marks with a one dimenstion array and a function.
3.
Find
the average of two assignment marks for
5 given students with 2D array and function.