What i am saying is
if i write it like
p[5]= 'a';
Then the compiler will raise an error . Because the memory where the
string constant Hello world gets stored is read only.
But it i do it like
char s[] = hello world,*p;
p=s;
p[5]='a';
It is valid becoz the string is now stored in
@ kumar
if we hav
char *p=hello world;
p[5]= 'a';
it generates only run time error and not compile time error
On Mon, Aug 22, 2011 at 10:47 AM, kumar raja rajkumar.cs...@gmail.comwrote:
What i am saying is
if i write it like
p[5]= 'a';
Then the compiler will raise an error . Because the
string are stored in fixed memory locations(thats why they called as
immutable). alteration to that memory location is not allowed.
Thank you,
Siddharam
On Mon, Aug 22, 2011 at 3:05 PM, aditi garg aditi.garg.6...@gmail.comwrote:
@ kumar
if we hav
char *p=hello world;
p[5]= 'a';
it
its a run time error(segmentation fault). it is placed in a read only memory
On Mon, Aug 22, 2011 at 3:05 PM, aditi garg aditi.garg.6...@gmail.comwrote:
@ kumar
if we hav
char *p=hello world;
p[5]= 'a';
it generates only run time error and not compile time error
On Mon, Aug 22, 2011 at
@Kumar: You've declared a pointer, and you can change the pointer,
just as in int i=10 declares an integer that you can change.
Dave
On Aug 21, 11:28 pm, kumar raja rajkumar.cs...@gmail.com wrote:
char *p= hello world;
When we try to modify the above string it will raise an error. I heard
You can change the pointer only, not the content.
But in case of static int, u can also change the value also. if u specify
const, u can't change the value then.
Sanju
:)
On Sun, Aug 21, 2011 at 9:56 PM, Dave dave_and_da...@juno.com wrote:
@Kumar: You've declared a pointer, and you can
What i am saying is
if i write it like
p[5]= 'a';
Then the compiler will raise an error . Because the memory where the string
constant Hello world gets stored is read only.
But it i do it like
char s[] = hello world,*p;
p=s;
p[5]='a';
It is valid becoz the string is now stored in stack