Veda Bites are swipeable micro-lessons — each one teaches exactly one
idea. Here's a taste from this kit; the app has the full deck.
💡 Key Idea
Arrays and Pointers: The Dynamic Duo
Arrays and pointers work together in C.
In C, an array is a collection of elements of the same type stored in contiguous memory locations. A pointer stores the memory address of a variable. The array name itself acts as a pointer to the first element, making them closely related. Understanding this relationship is key to eff...
↳ Arrays and pointers are two sides of the same coin in C.
📖 Definition
1D Array Declaration and Initialization
Declare and initialize arrays easily.
A 1D array is declared with `type array_name[size];`. For example, `int marks[5];` creates an array of 5 integers. You can initialize at declaration: `int marks[5] = {90, 85, 78, 92, 88};`. If fewer values are given, the rest are zero-initialized.
↳ 1D arrays store a fixed-size sequence of elements of the same type.
📖 Definition
Multi-dimensional Arrays
Tables and matrices in C.
A multi-dimensional array is an array of arrays. For example, `int matrix[3][3];` creates a 3x3 matrix. It is stored in row-major order, meaning rows are stored contiguously. Access elements with `matrix[row][col]`.
↳ Multi-dimensional arrays are arrays of arrays, useful for matrices and tables.