Pointers and Arrays in C

Pointers and Arrays in C

In this lesson, you will learn about pointers and arrays in C programming. Pointers are used to store the memory address of a variable and can be used to manipulate the data stored at that address. Arrays are used to store multiple values of the same type in a single variable. You will learn how to declare, define, and access pointers and arrays.


#include <stdio.h> 

int main() 
    int arr[5] = {1, 2, 3, 4, 5}; 
    int *ptr; 
    ptr = arr; 
    for(int i = 0; i < 5; i++) 
        printf("%d ", *(ptr + i)); 
    return 0; 


1 2 3 4 5

Leave a Reply