Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Pointer to array of pointers to characters

FargothFargoth Member Posts: 5
Hello, I need some help doing this. What I need is a dynamic array of dynamic strings. And I wouldn't be sure how to to get at the values. I thought something like this:

[code]char *(*aszWords);
[/code]

or am I barking up the wrong tree altogether?

Comments

  • whoiewhoie Member Posts: 672
    : Hello, I need some help doing this. What I need is a dynamic array of dynamic strings. And I wouldn't be sure how to to get at the values. I thought something like this:
    :
    : [code]char *(*aszWords);
    : [/code]
    :
    : or am I barking up the wrong tree altogether?

    Well, if this is C, then that is correct, but the parentheses are unnecessary. The compiler is already parsing the declaration like that. Check the C FAQ (second link in my signature) for some different approaches to this problem.

    If this is C++, then you would much rather use a std::vector.

    What the heck is that identifier supposed to stand for? I understand the 'Words' part, but 'asz'? Are those for Asian words or something?


    HTH,
    Will
    --
    http://www.tuxedo.org/~esr/faqs/smart-questions.html
    http://www.eskimo.com/~scs/C-faq/top.html
    http://www.parashift.com/c++-faq-lite/
    http://www.accu.org/


  • PatLDDDPatLDDD Member Posts: 30
    : : Hello, I need some help doing this. What I need is a dynamic array of dynamic strings. And I wouldn't be sure how to to get at the values. I thought something like this:
    : :
    : : [code]char *(*aszWords);
    : : [/code]
    : :
    : : or am I barking up the wrong tree altogether?
    :
    : Well, if this is C, then that is correct, but the parentheses are unnecessary. The compiler is already parsing the declaration like that. Check the C FAQ (second link in my signature) for some different approaches to this problem.
    :
    : If this is C++, then you would much rather use a std::vector.
    :
    : What the heck is that identifier supposed to stand for? I understand the 'Words' part, but 'asz'? Are those for Asian words or something?
    :
    :
    : HTH,
    : Will
    : --
    : http://www.tuxedo.org/~esr/faqs/smart-questions.html
    : http://www.eskimo.com/~scs/C-faq/top.html
    : http://www.parashift.com/c++-faq-lite/
    : http://www.accu.org/
    :
    :
    :

    Hello,

    the "asz" is a naming convention....
    a : array
    sz : string zero ( NULL terminated )....
    p : pointer
    st : static
    g : global
    c : const
    You get the picture


    stpcasz : static pointer to a const array of NULL terminated string.


    Pat

  • Andre YoungAndre Young USAMember Posts: 0

    _____ { http://forcoder.org } free ebooks and video tutorials about | Python PL/SQL Objective-C R Ruby Scratch MATLAB Perl Delphi C# Visual Basic PHP C++ Assembly Go Java C Visual Basic .NET JavaScript Swift Awk Rust Hack LabVIEW Scala Transact-SQL Julia Kotlin SAS Ada Dart Alice Logo Erlang D F# Fortran Clojure Lisp Prolog Apex COBOL ML Scheme Crystal Lua VBScript ABAP Bash FoxPro | _

Sign In or Register to comment.