arr
is an array and ptr
is a pointer of type int
.
There are differences . Let me list few
sizeof(arr)
is different from sizeof(ptr)
- You can do
ptr++
pointer operation using ptr
whereas arr++
is an invalid operation.
Going by your comment of what is the difference between pointer and array I have answered your question
int a = 10;
int b[5] = {1,2,3,45};
int *p = &a;
b = &a; /* not valid */
b
is a array and not a pointer so it can't hold address of a variable.
p = b;
p = p +1;
printf("%d\n",*p); /* valid as p is pointing to second element in the array */
b = b+1;
is not valid because array can't be a modifiable lvalue