Thread: Pass an string of array in a function

  1. #1
    Registered User
    Join Date
    Apr 2011

    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

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.

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, 09: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, 01: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, 08:41 AM