[A89] Re: c trouble


[Prev][Next][Index][Thread]

[A89] Re: c trouble



Mike McElroy wrote:

> In addition: Although you can use "char **foo" exactly the same way as 
> "char foo[3][3]" (meaning you can read and write values in foo), you 
> can't be guaranteed what "char **foo" will contain when you try to 
> access its contents, since something might overwrite it. Though it 
> might be nice to use for dynamic arrays and whatnot, it tends to be a 
> bad idea.

And this is about as f*d up as the last post. What in the world are you 
talking about?
You obviously know nothing about C and arrays and pointers.
char **foo is as said a pointer to a pointer to a char. if something 
else can overwrite this char (or any of the pointers) or any of the 
chars in the contigious block that the declaration char foo[3][3] 
allocates,  has absolutley nothing to do with this.
infact you can be just as sure or unsure.
its..  as scott said, hard to explain because your statement is so 
fundamentally wrong.
Something else can change it if you happen to have another pointer 
somewhere pointing to the same place.

And why would dynamic anything generally be a bad idea?
You should never allocate more memory then you use, specially not on a 
low memory device as a calc.
Sometimes you use static buffers for speed gain or general lazyness but 
thats about it.

--Olle







Follow-Ups: References: