Hello everyone,im a beginner in C programming.I've read a lot about the differences between arrays and pointers and I'm pretty confused.
First of all what is the name of an array???
Is it a label (or an alias) to the memory address or constant pointer?
Code:
#include <stdio.h>
int main()
{
char arr[] = "string";
char* ptr = arr;
printf("%c %c\n", arr[4], ptr[4]);
printf("%c %c\n", *(arr+2), *(ptr+2));
return 0;
}
What is the difference between *(arr+2) and *(ptr+2)?Does this have the same meaning to the compiler?
Thanks in advance for your answer.