Re: a few doubts!



"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.
.



Relevant Pages

  • Re: whose cc recognises byte moves
    ... Thank you, yes I see, on C platforms where long essentially means int, ... Writing shifts or byte moves commonly provokes actual C compilers to ...
    (comp.arch.embedded)
  • What I want in an editor/IDE
    ... I started writing this list because I wanted to have definite points ... start writing yet another IDE and so am now thinking in terms of new ... See the code outliner below. ... strings, normal strings and triple ...
    (comp.lang.python)
  • Re: combobox duplicates
    ... know what explicit references are worth, ... to prefix that dot again with a pointer variable. ... Writing 16 bit code for old, slow and dumb compilers is one thing. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Standard Read and Write FILE functions to refer to memory
    ... Those are the sort of things you want if you're trying ... specifically to read/write from/to strings. ... > pointers to functions that implement reading, writing, seeking, ... Since this is an extension, you have to define the macro ...
    (comp.lang.c)
  • Re: MATRIX PROBLEMS (AGAIN!)
    ... Start off writing a program that works on a small amount of data, ... don't have any idea whether you want integers in your matrix or strings. ... State what you intend to do with the result, ...
    (comp.lang.ruby)