Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
JennyHadir committed Oct 30, 2020
1 parent 7130b7e commit 5c1104c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions print_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
int print_r(va_list arg)
{
char *str = va_arg(arg, char *);
int i = 0;
int i = 0, counter = 0;

if (str == NULL)
str = "(nil)";
str = "(null)";
while (str[i])
i++;
i--;
for (; str[i]; i--)
for (; i >= 0; i--)
{
_putchar(str[i]);
return (i);
counter++;
}
return (counter);
}

0 comments on commit 5c1104c

Please sign in to comment.