Professional Documents
Culture Documents
Lecture 3
Lecture 3
Lecture 3
Introduction to Programming in C
Ben-Gurion University of the Negev
Based on slides by Dr. Wan-Lei Zhao
• Opening Discussion
15 minutes to solve
• 1D Arrays – Example
15 minutes to solve
• 1D Arrays – Example 2
• 1D Arrays – Example 3
• Given a sorted array: a[7] = {3, 14, 15, 18, 22, 35}
• Insert an input number to the array while keeping the array
sorted.
• You can pop the first element to clear space.
15 minutes to solve
• 1D Arrays – Example 3
• 1D Arrays – Example 4
• Let’s continue with the opening example from the last section
• In your class, you might have several courses.
• So we need several 1D arrays
• Or alternatively, we can use a 2D array
• 2D Arrays – Declaration
𝑁
• Following way is also valid, 𝑟𝑜𝑤 =
4