# Thread: Need explaination of the following function

1. ## Need explaination of the following function

Does anyone know what is the following two function does. Can i have an explaination of that??

Code:
```void reverse(char s[])
{
int i=0,j;
char a,b;
j=strlen(s)-1;
while(i<j)
{
a=s[i];
b=s[j];
s[j--]=a;
s[i++]=b;
}
s[strlen(s)]='\0';
}```
Code:
```void itoa(int i)
{
int back=0;
do {
fil[back]= i % 10 + '0';
i =i/10;
//	  printf ("%d", i);
back++;
} while (i>0);
fil[back]='\0';
reverse(fil);
}```

Thanks

2. It would appear that the first function reverses the order of characters in a string, while the second converts an integer into a character (itoa() is a standard C function - but with a different prototye). I find it odd that neither function returns anything - where did you find these?

3. Originally Posted by sean_mackrory
itoa() is a standard C function
Huh?

4. atoi()

5. both functions do not need to return any values because they store the result in arrays and the result can be accessed from other functions from this array. First function reverses a given string by interchanging first and last character, then the 2nd and last but one and soon and at last appends a null character to the reversed string. Second funciton converts a number to its string equivalent. This is done by adding the digits to '0' to get the ascii value of that number. At last the whole string is reversed.

6. Huh?
atoi()
Ah!.