What is preventing me from running this code?

#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?

>Solution :

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 like

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

enter image description here

Leave a Reply