What is the difference between char *a and char a?For char array, such size is not accepted by the compiler. If the size is specified, the following are the differences between char *a and char a:
- The unary increment (++) or decrement (--) operators can not be used on arrays, where as they can be used in pointers (pointer arithmetic).
- The address of an element of the array is constant; where as the address of an element of the pointer is not.
- The variable *a is a constant pointer, where as a is not.
- The array can not be assigned to another array, where as the pointer to char can be assigned to another char pointer.
- The char array allocates equal to size of the string, where as the char pointer holds only the address of the first character of the string.