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*

25
  • 2
    Because function parameter sf::Vector2f points[] really means sf::Vector2f* points. It is a syntactic strangeness of the language. Commented Nov 17, 2014 at 19:34
  • 1
    Which compiler are you using? I'm not trying to be difficult: the code you want to use is wrong for a slighlty different reason in C++11 than it was in earlier versions of the language, but it's possible to add an overload to fix that code in C++11. Commented Nov 17, 2014 at 19:37
  • 2
    After all, whats the error the compiler give you?? Commented Nov 17, 2014 at 19:41
  • 3
    @Fly {a, b, c} is not an array. It is a special kind of initializer that can be used to initialize arrays. But it cannot be used to initialize a pointer. As I said in my first comment, your function's parameter is a pointer. Commented Nov 17, 2014 at 20:02
  • 2
    int* is a pointer to an int. That's all. The thing it, C++ gets pointer arithmetic from C, so you can use a pointer to an int to access ints next to it, which means you can almost treat a pointer to int as an array of int. This is so confusing and dangerous that you'll quickly learn to avoid it and use types with better defined semantics. Commented Nov 17, 2014 at 20:15