What is the difference between char *a and char a[]?

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.
Define void pointer
A void pointer is pointer which has no specified data type. The keyword ‘void’ is preceded the pointer variable......
What is a const pointer?
A const pointer is not the pointer to constant, it is the constant. For example, int* const ptr; indicates that ptr is a pointer......a
Explain memory leak
An unwanted increase in programs is referred as a memory leak is C language...
Post your comment