I want to change the contents of a constant-character-array
(const array[64]
).
Below is my code.
My Question is, why does the constant character array doesn t change(not reflected back), when passed to the function as constant character pointer(const char *append
)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int function(char *d,const char *append)
{
append = d; //changing the location of append.
printf ("%s
",append); //displays as sachintendulkar.
}
int main()
{
char *d = NULL;
const char append[]={ s , a , c , h , i , n };
d = calloc(sizeof(char),sizeof(append));
strcpy(d,append);
strcat(d,"tendulkar"); //appending
function(d,append);
printf ("%s
",append); //Its displays as sachin instead of sachintendulkar???
}