1 Arrays & strings
An array is a contiguous block of elements indexed from 0. A C string is a char array ending in a \0 terminator.
int a[3] = {10, 20, 30};
printf("%d\n", a[1]); // 20
char name[] = "Ada"; // {'A','d','a','\0'}Arrays, pointers, functions and memory — the heart of systems C.
An array is a contiguous block of elements indexed from 0. A C string is a char array ending in a \0 terminator.
int a[3] = {10, 20, 30};
printf("%d\n", a[1]); // 20
char name[] = "Ada"; // {'A','d','a','\0'}A pointer holds an address. &x takes the address of x; *p dereferences it. Pointers enable arrays, strings and pass-by-reference.
int x = 5;
int *p = &x; // p points to x
*p = 99; // x is now 99Functions break problems into reusable units. Choose efficient algorithms: searching a sorted array with binary search is O(log n) versus O(n) for a linear scan. (The example below runs on the simulator.)
#include <stdio.h>
int main() {
int sum = 0;
for (int i = 1; i <= 100; i++) sum += i;
printf("sum 1..100 = %d\n", sum);
return 0;
}
Code runs on a learning-oriented simulated runtime that supports common constructs (output, variables, arithmetic, conditionals and loops).
5 tasks across 2 pages — multiple-choice and fill-in (type the answer). Score 70% or higher to earn your certificate.
🔒 Pass the quiz above (70%+) to unlock your downloadable certificate.
Congratulations! Enter your name to generate your certificate.