There are three type of string pointer.

const char * - This is a mutable pointer which points to a constant string.

Example:

const char * str = "Hello World";
str++;//OK
str[0] = ' ';//Not compilable

char * const - This is a const pointer pointing to a writable string.

Example:

char * const str = "Hello World";
str++;//Not Compilable
str[0] = ' ';//OK

const char * const - This is a const pointer pointing to a read-only string.

Example:

const char * const str = "Hello World";
str++;//Not Compilable
str[0] = ' ';//Not Compilable

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

adjacency Matrix, Circular buffer, char array and char pointers, const char *,char * const, const char * const, alpha numeric, palindrome, convert case, string to int,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan