I keep getting run failed when ever i try to print out this character.Code:char *c; *c='9'; printf ("%c",*c);
I keep getting run failed when ever i try to print out this character.Code:char *c; *c='9'; printf ("%c",*c);
Your code exhibits undefined behaviour, as c has not been initialised so does not point at anything. It is necessary to ensure c points at something valid, before dereferencing *c (even accessing the value of *c gives undefined behaviour, let alone assigning a value to *c as you are)
Code:char x; char *c = &x; *c = '9'; /* this will change x */ printf ("%c",*c);