On 8/9/06, ravikohli2412 <[EMAIL PROTECTED]> wrote:
> #include<stdio.h>
> void main()
int main(void)
> {
> char a[]="abc";
Here you create a read/write string 4 characters long.
> char *b="good";
Here you create a pointer to a read only string. This should be written:
const char*b = "good";
> b[0]='a';--THis line gives error
You're trying to write to read-only memory.
> strcpy(b,"fff");--This line gives error
For the same reason.
> }
>
> Can anybody explain me the procedure how the variables 'a' and 'b' get
> stored and initialized in memory.
Why? You don't need to know this to realise the difference between
what you can change and what you're not allowed to change.
>Also please let me know the cause of
> the error.
--
PJH
Into motorcycles? Need parts? Try www.gissit.com to contact lots of
motorcycle breakers - free to use (UK based at the moment)
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/