#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    30
    Rep Power
    2

    Arrays as function arguments


    Why can't I pass arrays as function arguments?

    Code:
    void function(char array[5])
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,242
    Rep Power
    2222
    You can, if you know how.

    Since we cannot read your mind, we cannot have any idea what you have tried. Obviously, what you displayed there is not a function call.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    30
    Rep Power
    2
    Okay.. Never mind my question cause I have found my answer.
    I got another question though.

    Code:
    void putString(char *m) {
        statements....
    }
    Suppose that I declared a function called putString. Does its argument in the italic declare a pointer?
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,242
    Rep Power
    2222
    Yes, it does. As the syntax clearly states.

    Shouldn't you have been learning what C syntax says instead of constantly questioning why it's written the way that it is?

IMN logo majestic logo threadwatch logo seochat tools logo