Are C arrays pointers ?
Using pointers instead of arrays
Pointers and Arrays in C - what's the issue with this code?
Arrays and Pointers as a beginner
How can I use pointers to dynamically allocate arrays in C/C++?
How can I avoid common mistakes when using pointers and arrays in C/C++?
How do pointers and arrays work together in memory management?
Videos
Hello,
I'm new to C and would like to understand the differences between pointers and arrays. Everyone keeps telling me arrays are pointers but the following situation confuses me :
When i declare an array :
int myArray[] = {1,2,3,4};
I can get a pointer on the first element of this array:
int* myPointer = myArray;
When iterating in a for loop, i can use the following :
*(myPointer+i) = ... or
*(myArray+i) = ...
When iterating in a while loop, i can use my pointer :
*myPointer++ = ... but can't use
*myArray++ = ...
Is it because arrays are not pointers and increment operator is not defined for arrays ?
Thanks for your help 🙂