Can someone pls explain to me this program is not running

#include <iostream>
using namespace std;

void writeBackward(string s, int size) // function definition
{                     //opening brace
       
  if ( size > 0)
     {             // opening brace for the condi
      cout<<s.substr((size-1), 1); //display the last chracter
       writeBackward(s, (size-1));  //display remaining characters
     }     //end if
 }  /

int main()
{
writeBackward("Hello", 5);
return 0;
}

there is a slash '/' at the end of function.
Remove it.

#include <iostream>
using namespace std;

void writeBackward(string s, int size) // function definition
{ //opening brace

if ( size > 0)
{ // opening brace for the condi
cout<<s.substr((size-1), 1); //display the last chracter
writeBackward(s, (size-1)); //display remaining characters
} //end if
} 

int main()
{
writeBackward("Hello", 5);
return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.