25.08.2018, 17:15
Код:
Function:Reverse(string[]) { new string1[256]; for(new i = 0, j = strlen(string); i < strlen(string); i++, j--) { string1[i] = string[j]; } return string1; }
Function is just a macro I've made.
Function:Reverse(string[]) { new string1[256]; for(new i = 0, j = strlen(string); i < strlen(string); i++, j--) { string1[i] = string[j]; } return string1; }
Function:Reverse(string[])
{
// Setting vars
new string1[256];
lengthOfString = strlen(string);
// Processing
for(new i = 0; i < strlen(string); i++)
{
string1[i] = string[(lengthOfString-i)];
}
// Returning processed string
return string1;
}
printf("%s", Reverse("Teeeeeeeeeext"));