char *body[line][charLength];
Guys, correct me if I'm wrong but I do believe this is declaring a 3D array, not a 2D like he wants.
Printable View
char *body[line][charLength];
Guys, correct me if I'm wrong but I do believe this is declaring a 3D array, not a 2D like he wants.
True, a (well-known) typo. However, if you mix up [] with () when DECLARING a vector, any average compiler will catch that up.
It's just related to post count. I didn't notice it had changed.Quote:
Originally Posted by ariell
All true (although I would describe it in terms of class semantics). I was simply mentioning that the "copying" statement didn't seem relevant to any of that. Nothing you said was wrong; but your phrasing implied a causal relationship which I don't think exists. But that's neither here nor there.Quote:
Everything you say is right, and I am definitely not supposed to warm up stack/heap discussions. However, in the given context, your words are "incomplete". I tried to explain that bounds (defined as having to be constant) are to "work-around" with vectors to show the decisive difference: Constant expressions are SIMPLE expressions, evaluated by a compiler BEFORE an app is LINKED. A vector (object) assigned with a var (which "n" is in my example), will be determined at RUNTIME.
Maybe I took a strange approach, sorry in advance.
You think that's "dangerous", you obviously didn't see any of the Star Trek forums the day Enterprise was canceled.Quote:
P.S. is it always that dangerous to post here?
Use string rather than char array.
If you want multidimensional char array is this syntax.
char *aStr[10] -- Need allocate memory
char aStr[10][200] Not require allocate memory on runtime.
Both syntax is same.
I hope this help.
Technically, yes. The final dimension stores a pointer to a null-terminated array of char's, aka a c-style string. In that context most people will talk about a 2D array of strings rather than a 3D array of char.Quote:
Originally Posted by jmass16
First of all: Thanks for that StarTrek hint - I didn't laugh like that in a long time.
Just dropped by cos I started a big compile/build, which is a perfect chance to have a break.
I agree with putting it in the context of class semantics, it is definitely more precise. Be that as it may, when you're new and feel to be under attack you'll try to make a post as short as possible.
However, not, that things are "calmed", I feel much better, and I learned, that boards/forums is quite obviously not what I am good for.
A great time to everybody, and best from the south.