Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • The problem lays in sizeof array which can not be correct when foreach is called from Words(int v[]) function. If you put Words code directly in loop then it should work: did you check that? Commented May 6, 2016 at 6:25
  • Yes that does work, but I just want to be able to call from the void to save space and keep my code clean and more readable, I will be calling it many times with different arrays so to have many foreach loops is going to get rather messy. Commented May 6, 2016 at 6:45
  • Then your only option is to explicitly pass the array size (number of items) as an extra argument. Commented May 6, 2016 at 6:51
  • How is that done? Commented May 6, 2016 at 6:53