🔹 Day 39 of #100DaysOfCode Topic: Pointer Arithmetic and Array Manipulation in C Today I practiced accessing and modifying array elements using pointers. Here's a breakdown of what the code does: 🧠 Code Summary: Array Declaration: An integer array arr[] is initialized with values {10, 20, 30, 40, 50}. Pointer Initialization: A pointer ptr is assigned to point to the first element of the array (arr). Accessing Elements via Pointer Arithmetic: Using *(ptr + i), each element is accessed by moving the pointer i steps forward. This demonstrates how pointers can traverse arrays without using traditional indexing. Modifying Elements via Pointer Arithmetic: Each element is incremented by 5 using *(ptr + i) += 5. This shows how pointers can directly modify array values. 🖥️ Output: The program first prints the original array values, then prints the updated values after adding 5 to each. #CProgramming #PointersInC #ArrayManipulation #CodeNewbie #LearnToCode 

To view or add a comment, sign in

Explore content categories