'What is preventing me from running this code? [closed]

#include <iostream>
#include <string>

void showResults(std::string* r);

int main()
{
std::string students[10] = { "1", "2", "3" };
std::string* r = students;

showResults(r);

system("pause >> null");
return 0;
}

 void showResults(std::string* r)​ {
 int i = 0;
 for (i; i < 10; i++)
{
    std::cout << *r << "\n";
    r++;
}
}

its giving me an error around the bottom function, but not saying what kind of error. I tried a lot of things myself, including different text editors, but nothing seems to work. Can anyone here help me?

c++


Solution 1:[1]

everything is okay except there is a set of characters should be removed , kind of hidden encoded.

void showResults(std::string* r)? {
......
}

before the first curly brace, remove that, In Clion it show like this

void showResults(std::string* r)??ZWSP{
......
}

enter image description here

Solution 2:[2]

You have a zero-width-space character (\u200B) at this place, you just need remove it.

void showResults(std::string* r)? {
                                ^

Solution 3:[3]

I tried the code myself, and it produces a compiler error because there is some stray unicode character at that line. Just remove that characters.

void showResults(std::string* r)? {
                                ^

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 IamNOTaROBOT
Solution 3