mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2024-10-27 20:34:19 +00:00
Merge b723892dc0
into ce8e050d24
This commit is contained in:
commit
959c193db8
@ -26,5 +26,15 @@ void int_to_ascii(int n, char str[]) {
|
||||
if (sign < 0) str[i++] = '-';
|
||||
str[i] = '\0';
|
||||
|
||||
/* TODO: implement "reverse" */
|
||||
// reverse
|
||||
char aux_char = 0;
|
||||
unsigned int front_index = 0;
|
||||
unsigned int back_index = strlen(str)-1;
|
||||
while(front_index < back_index){
|
||||
aux_char = str[front_index];
|
||||
str[front_index] = str[back_index];
|
||||
str[back_index] = aux_char;
|
||||
front_index++;
|
||||
back_index--;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user