“mobile”/ paypertrail
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

C Programming: Can I return an array (from a function)?

Discussion in 'Programming and Scripts' started by randycrosby2017, Aug 4, 2017.

  1. randycrosby2017

    randycrosby2017 Affiliate affiliate

    8
    1
    3
    Can an array be a return value from a function?

    eg. char function (void) { /* some codes */ return aArrary[10] = { /*some values */ }?
     
  2. CPA Evolution
  3. no2pencil

    no2pencil Affiliate affiliate

    230
    95
    28
    While my C is pretty rusty, I think you would use a pointer to the array & pass that as an INT.

    Though I would ask, if you are not passing anything into the function, what action are you taking that you end up with values to return?
     
banners