Pass an string of array in a function

This is a discussion on Pass an string of array in a function within the C Programming forums, part of the General Programming Boards category; Hi, I'm having a array of strings. char identifier[arraylength][stringlength]; I would like to pass this array in a function. (ie) ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    1

    Pass an string of array in a function

    Hi, I'm having a array of strings.

    char identifier[arraylength][stringlength];

    I would like to pass this array in a function. (ie) f(identifier).

    I want to know the syntax of the subfunction, as well as declaration.

    if i use,

    functionname(char a[arraylength][stringlength])

    then I am getting error message. I am weak in pointers. Kindly help me.

    Thank You
    KP

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,765
    Well the syntax is correct, unless arraylength and stringlength are variables at run-time you're using to create a variable length array.

    > then I am getting error message.
    Post actual error messages then.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how can i pass this array to my function?
    By kosodo in forum C Programming
    Replies: 4
    Last Post: 04-14-2006, 10:40 PM
  2. Pass a string to a function
    By colinuk in forum C Programming
    Replies: 10
    Last Post: 01-31-2005, 08:05 PM
  3. How to pass an array of pointers to a function?
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 04-26-2002, 02:23 AM
  4. Replies: 3
    Last Post: 04-02-2002, 01:39 PM
  5. how to pass 2D array into function..?
    By IngramGc in forum C++ Programming
    Replies: 2
    Last Post: 10-21-2001, 09:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21