summaryrefslogtreecommitdiffstats
path: root/4/7.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-12-12 12:47:40 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-12-12 12:47:40 +0800
commit89bcb7ebbdb05d86b5e8999f3ccf94fd9d9d0821 (patch)
tree4d6afbd8d77f3d3ddf79deeccb7269436bbac390 /4/7.c
parent3f3aa6df9592b8175bad9e119fdabb23cfb516cb (diff)
downloadk&r-exercises-89bcb7ebbdb05d86b5e8999f3ccf94fd9d9d0821.tar.gz
4.7
Diffstat (limited to '4/7.c')
-rw-r--r--4/7.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/4/7.c b/4/7.c
index 7d3ccad..9ddc2bb 100644
--- a/4/7.c
+++ b/4/7.c
@@ -170,7 +170,7 @@ void ungets(char s[]) {
if (bufp + len - 1 >= BUFSIZE)
printf("ungets: too many characters\n");
else {
- for (i = 0; i < len; i++)
+ for (i = len; i >= 0; i--)
buf[bufp++] = s[i];
}
}