[A89] Re: Weird problem with some character arrays...


[Prev][Index][Thread]

[A89] Re: Weird problem with some character arrays...




Actually, it is a 20 character array, but it just goes from 0 to 19... which
is 20 characters... writing to array[20] will not generate any error but
usually causes problems since you don't know what is there...

--Andrew

-----Original Message-----
From: assembly-89-bounce@lists.ticalc.org
[mailto:assembly-89-bounce@lists.ticalc.org]On Behalf Of John David
Ratliff
Sent: Monday, May 28, 2001 2:52 AM
To: assembly-89@lists.ticalc.org
Subject: [A89] Re: Weird problem with some character arrays...



Nevermind. I figured out the problem was in my use of declaring the arrays.

I was thinking

char var[20];

was a 21 character array 0-20, but it's really a 19 character array 0-19,
with 20 possible characters.

This is why I don't usually post things..., I feel stupid afterwards...

John David Ratliff
jdratlif@cs.indiana.edu

-----Original Message-----
From: assembly-89-bounce@lists.ticalc.org
[mailto:assembly-89-bounce@lists.ticalc.org]On Behalf Of John David
Ratliff
Sent: Monday, May 28, 2001 1:56 AM
To: assembly-89@lists.ticalc.org
Subject: [A89] Re: Weird problem with some character arrays...



I don't quite get your meaning here... Are you saying using the word copy is
bad. The whole function is bad? Everything in between the definition of copy
and the assignment of the null character at the end is bad.

What does that mean?

John David Ratliff
jdratlif@cs.indiana.edu

-----Original Message-----
From: assembly-89-bounce@lists.ticalc.org
[mailto:assembly-89-bounce@lists.ticalc.org]On Behalf Of Kevin Goodsell
Sent: Monday, May 28, 2001 12:25 AM
To: assembly-89@lists.ticalc.org
Subject: [A89] Re: Weird problem with some character arrays...



> char copy[40];

...

>
> copy[40] = 0;

Bad idea.

-Kevin













References: