How to initialize const char **str

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kiran Pagar

    How to initialize const char **str

    For an API of software named Teamcenter I need to pass arguments to function in following format.

    function(const char **str1, const char ** str2)

    So, I have to initialize const char **str.
    Last edited by Niheel; Nov 16 '10, 06:16 AM.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    It expects a pointer to a character array.

    Code:
    char *str1 = "String 1";
    char *str2 = "String 2";
    
    /* expects a point to a character pointer */
    some_function (&str1, &str2);
    Mark.

    Comment

    • newb16
      Contributor
      • Jul 2008
      • 687

      #3
      It may as well expect something like this
      Code:
      char *a="abcd"; char*b = "dcba";
      char *s[2] = {a,b};
      some_function(s);

      Comment

      Working...