Re: How to passing multidimesional array of string to function?

Discussion in 'C Programming' started by Barry Schwarz, Jul 27, 2012.

  1. On Monday, July 23, 2012 6:53:29 AM UTC-5, Alter wrote:
    > Hi all
    >
    > How to pass a multidimensional array of string to a function?


    In the function prototype and in the function definition, you declare the parameter that will correspond to the array to exactly match the definition of the array itself. For example:

    If your array of string is defined as char x[12][45] then your function should specify void f(char y[12][45]) and you would call the function with f(x);

    If your array of string is defined as char *x[26] then your function should specify void f(char *y[26]) and you would call the function with f(x);

    Later, when you understand the intricacies of how arrays are passed to functions, you can start to look at other declarations.
     
    Barry Schwarz, Jul 27, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Sosman
    Replies:
    8
    Views:
    473
    Stephen Sprunk
    Jul 25, 2012
  2. Ben Bacarisse
    Replies:
    0
    Views:
    384
    Ben Bacarisse
    Jul 23, 2012
  3. Malcolm McLean
    Replies:
    0
    Views:
    385
    Malcolm McLean
    Jul 23, 2012
  4. Varun Tewari
    Replies:
    5
    Views:
    435
    Phil Carmody
    Jul 29, 2012
  5. aftnix
    Replies:
    0
    Views:
    363
    aftnix
    Jul 26, 2012
Loading...

Share This Page