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.

Required fields*

3
  • you can also loop sscanf from a function then return the array Commented Jul 31, 2016 at 1:55
  • Welcome to Stack Overflow. Please read the About page soon. When you answer a question over 6 years after it is asked (and it has up-voted and accepted answers), you must have something distinctive to add — a novel approach, or perhaps the product has changed since the original answers were given. Fortunately for you, none of the other answers suggests parsing a string representation of the array values — so that much is OK. I'm not sure it is a good mechanism, but it is different. Your call to malloc() is not allocating enough space on any machine where sizeof(char) != sizeof(int). Commented Jul 31, 2016 at 2:09
  • edited malloc, if using strings does not work, you can also use the functions from stdarg.h Commented Jul 31, 2016 at 11:28