CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Join Date
    Nov 2007
    Posts
    23

    Re: I'm SICK of THIS! WHY THIS CODE DOES NOT WORK!

    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.

  2. #17
    Join Date
    Oct 2008
    Location
    Tel Aviv, Berlin, L.A.
    Posts
    23

    Re: I'm SICK of THIS! WHY THIS CODE DOES NOT WORK!

    True, a (well-known) typo. However, if you mix up [] with () when DECLARING a vector, any average compiler will catch that up.
    ariell
    programming is understanding

  3. #18
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: I'm SICK of THIS! WHY THIS CODE DOES NOT WORK!

    Quote Originally Posted by ariell
    First of all, this is what is printed right under your name. It must not catch you by surprise, that a newbee like me recognizes such details.
    It's just related to post count. I didn't notice it had changed.

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

    P.S. is it always that dangerous to post here?
    You think that's "dangerous", you obviously didn't see any of the Star Trek forums the day Enterprise was canceled.
    Last edited by Lindley; October 1st, 2008 at 09:27 PM.

  4. #19
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: I'm SICK of THIS! WHY THIS CODE DOES NOT WORK!

    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.

  5. #20
    Join Date
    Aug 2007
    Posts
    858

    Re: I'm SICK of THIS! WHY THIS CODE DOES NOT WORK!

    Quote Originally Posted by jmass16
    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.
    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.

  6. #21
    Join Date
    Oct 2008
    Location
    Tel Aviv, Berlin, L.A.
    Posts
    23

    Re: I'm SICK of THIS! WHY THIS CODE DOES NOT WORK!

    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.
    ariell
    programming is understanding

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured