At a low level, the following is a list of differences I've found from looking at a one-dimensional array, and a pointer that references what would be the equivalent of a one-dimensional array. Here is the Compiler Explorer showing the differences I've found, and the code below:
#include <stdio.h>
void function(void) {
// 1. array has elements stored in contiguous-memory
// whereas ptr is single 8-byte memory address value
int nums[] = {1,2,3};
int* ptr_nums = &nums[0];
// 2. compile-time sizeof is different
// ptr will always be 8 bytes, arr = unit_size * size
printf("Sizeof: %zu", sizeof(nums));
printf("Sizeof: %zu", sizeof(ptr_nums));
// 3. assignment-to-ptr is valid, but not array
// by extension, arithmetic on ptr is allowed, not array
// nums += 1; // invalid
ptr_nums = ptr_nums + 2;
// 4. string-literal initialization is 'literal' rodata value
// for pointer, but contiguous chars in memory for array
char name[] = "ABC"; // something like: mov $6513249, -24(%rbp)
char* name_ptr = &name[0]; // will not create string literal
char* name_ptr2 = "QCI"; // pointer to rodata string literal
// 5. address-of operator
// &array returns address of first element
// &ptr return the address of pointer
// (which *would not* be the same as the first element of the array if it pointed to that)
printf("%zd", &nums);
printf("%zd", &ptr_nums);
}
Are there any other differences that I may be missing?