This example demonstrates two common ways to initialize arrays in C: using an initializer list and using a loop to set values.
This example shows two methods to traverse an array: using array indexing and using pointer arithmetic.
This code demonstrates a linear search to find a specific element in an array. It iterates through the array and stops when the target is found or the end is reached.
This example implements the Bubble Sort algorithm to sort an array in ascending order. It repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
This function reverses the order of elements in an array in-place. It uses two pointers, one starting from the beginning and one from the end, swapping elements as it moves towards the center of the array.
This code rotates an array to the left by a specified number of positions. It first stores the elements to be rotated, then shifts the remaining elements, and finally places the stored elements at the end.
This code merges two sorted arrays into a single sorted array. It compares elements from both arrays and adds them to the result array in the correct order.
This example demonstrates operations on a 2D array, including initialization, traversal, and element summation. It shows how to access and manipulate elements in a multi-dimensional array.
This example shows how to dynamically allocate memory for an array, resize it, and properly free the memory. It demonstrates the use of malloc() for initial allocation, realloc() for resizing, and free() for deallocating memory.