#include<stdio. h>
#include<conio. h>
#include<string .h>
main()
{
char * a= "bcd";
clrscr();
strcpy(a,"hello ");
a = "fgh";
a[0] = 't';
printf("%s",a);
}
now, in TC there is absolutely no error .....i thought it
should........c oz' when i declare a as a char * and assign it to some
string then it should be a constant and cannot do things like a[0] = '4'
and stuff........in fact the entire thing here works properly....so why
should it work properly??
#include<conio. h>
#include<string .h>
main()
{
char * a= "bcd";
clrscr();
strcpy(a,"hello ");
a = "fgh";
a[0] = 't';
printf("%s",a);
}
now, in TC there is absolutely no error .....i thought it
should........c oz' when i declare a as a char * and assign it to some
string then it should be a constant and cannot do things like a[0] = '4'
and stuff........in fact the entire thing here works properly....so why
should it work properly??
Comment