What if you could instantly share and update huge data without wasting time or space?
Why pointers are needed in C - The Real Reasons
Imagine you want to share a big photo album with a friend. Instead of giving them the whole album, you just give them the address where it is stored. This way, they can look at the album anytime without making a copy.
If you try to copy the whole album every time you want to share it, it takes a lot of time and space. Also, if you want to change something in the album, you have to copy it again and again, which is slow and can cause mistakes.
Pointers in C let you share the address of data instead of copying it. This means you can work with the original data directly, saving time and memory. It also helps you change data in one place and have those changes seen everywhere.
int arr[1000]; // Copy array to another int copy[1000]; for(int i=0; i<1000; i++) copy[i] = arr[i];
int arr[1000];
int *ptr = arr; // pointer to original arrayPointers enable efficient data sharing and modification without unnecessary copying, making programs faster and more memory-friendly.
When you pass a large list of names to a function, using pointers lets the function access and change the original list directly, instead of making a slow copy.
Pointers let you work with data addresses, not copies.
This saves time and memory in programs.
Pointers help change data in one place and see updates everywhere.