Skip to content

C_Arrays.c

SunilOS edited this page Sep 9, 2024 · 2 revisions

C_Arrays.c

Explanation:

  • #include <stdio.h>: This includes the standard I/O library needed for the printf function.
  • int arr[3] = {1, 2, 3};: Declares an array of 3 integers and initializes it with values 1, 2, and 3.
  • for (int i = 0; i < 3; i++): A loop that iterates through each element of the array.
  • printf("arr[%d]: %d\n", i, arr[i]);: Prints the index and value of each element in the array.

Clone this wiki locally