Re: a few doubts!
- From: SM Ryan <wyrmwif@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 18:57:04 -0000
"maadhuu" <madhu_ranjan_m@xxxxxxxxx> wrote:
# #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);
# }
Some compilers allow strings to be overwritten by placing them in read-write memory
sometimes with the expectation the string can be modified. Writing outside an array
bounds does not necessarily trigger a fault action.
The code results are machine and compiler dependent.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
I think that's kinda of personal; I don't think I should answer that.
.
- Follow-Ups:
- Re: a few doubts!
- From: Keith Thompson
- Re: a few doubts!
- References:
- a few doubts!
- From: maadhuu
- a few doubts!
- Prev by Date: Re: struct and function-pointer casting
- Next by Date: Re: return a string
- Previous by thread: Re: a few doubts!
- Next by thread: Re: a few doubts!
- Index(es):
Relevant Pages
|