How to use *input[] as argument

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kjells_@hotmail.com

    How to use *input[] as argument

    How can I call a function which takes an argument like this

    void func(char *inout[]);

    This works okay:
    char *pOutPut[500];
    for(int i = 0; i < 10; i++)
    {
    pOutPut[i] = (char*) malloc(33);
    }
    func(pOutPut);

    But if I don't want to use dynamic memory
    char pout[10][33];
    func(pout); // Compiler error !

    func(char **)pout); // exception!




  • Flash Gordon

    #2
    Re: How to use *input[] as argument

    kjells_@hotmail .com wrote, On 28/09/08 19:54:
    How can I call a function which takes an argument like this
    >
    void func(char *inout[]);
    <snip>
    But if I don't want to use dynamic memory
    char pout[10][33];
    func(pout); // Compiler error !
    <snip>

    Start off with question 6.18 of the comp.lang.c FAQ at http://c-faq.com/
    then look through the rest of section 6.
    --
    Flash Gordon
    If spamming me sent it to smap@spam.cause way.com
    If emailing me use my reply-to address
    See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/

    Comment

    Working...