Find the answer to your Linux question:
Results 1 to 3 of 3
Say i have a function that takes in one arg eg func(int *numbers[]); now is that arg an array of int pointers or a pointer to an array of ints? ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    12

    C++ ptr array question ***Solved***

    Say i have a function that takes in one arg
    eg
    func(int *numbers[]);

    now is that arg an array of int pointers or a pointer to an array of ints?

    Thanks

    ****NOTE****
    i found out its a pointer to an array of ints.

  2. #2
    Just Joined!
    Join Date
    Feb 2009
    Posts
    13
    its array of pointers I think...

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    It's an array of pointers to ints. If it was a pointer to an array of ints it would either be int* numbers, or int numbers[]. In any of these cases, however, it is VERY bad that the function call doesn't have an argument that specifies how many entries there are in the array. That failure is a sure fire way to a buffer overflow security breach.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...