Hi Dave
DVH>> char name[40];
DVH>> gets(name);
DVH>> name[40]='\0';
>
TT>> That still leaves the problem that you're writing to memory that
TT>> isn't yours. Your array is only 40 characters long and you try to
TT>> access the 41st element!
>
> Actually it is correct. I don't know where you see anything wrong,
I think Tom means that name[40]='\0' should be name[39]='\0' since C/C++ is
zero based (i.e 0 is always the first element hence 39 is the fortieth and 40
is the fortyfirst).
John.
--- JetMail 0.99beta23
---------------
* Origin: The Dysfunctional Refrigerator (fidonet 2:2502/60)
|