#include <stdio.h>

int main()
{

	/**********************************
	 *  Part 1  const pointer to a    *
	 *  character.  It is set to      *
	 *  a character and not changed   *
	 *                                *
	 **********************************/
	char A_char = 'A';

	// This reads as charPtr is a constant pointer to a character
	// Always point to the same character
	char * const charPtr = &A_char;
	//char * const charPtr;
	//charPtr = &A_char;

	A_char = 'M';

	printf("A_char is %c\nThe pointer is pointing to %c\n", A_char, *charPtr);

	char B_char = 'B';

	//This also reads as charPtr2 is a constant pointer to a character
	char * const charPtr2 = &B_char;


	printf("B_char is %c\nThe pointer is pointing to %c\n", B_char, *charPtr);

	//now try to point it to what charPtr is pointing to
	//Both of these should give us an error
    /*The first says charPtr2 equals what charPtr is pointing to
      the second is simply trying to change the address that charPtr2 is
      pointing to.  Both give an error.
    */
	*charPtr2 = *charPtr;
	//charPtr2 = &A_char;
	printf("charPtr is %c and charPtr2 is %c\n", *charPtr, *charPtr2);

	

 	/************************************
 	 *Part 2 Location pointed by a      *
 	 *pointer will not change           *
 	 *This does not mean that C can     *
 	 *not change its value it means the *
 	 * *charPtr can not change c's value*
 	 ************************************/

 	 char C_char = 'C';
 	 //This reads as charPtr3 points to a constant character
 	 const char *charPtr3 = &C_char;

 	 printf("C_char is %c  ",*charPtr3);

 	 //This can not be done.
 	 //*charPtr3 = 'Y';
 	 //however this is ok
 	 C_char = 'Y';

 	 printf("C_char is %c now\n", *charPtr3);

 	 char D_char = 'D';



	return 0; 
}