diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-29 19:57:23 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-29 19:57:23 +0800 |
| commit | 807b4e70b1a286ac7fe1f28517c05805f428089c (patch) | |
| tree | d4ea4dd492b5da801379325269bfc8c5e3e95e8b /4/13.c | |
| parent | e7242d30471a02d648846c3a63226315126748fc (diff) | |
| download | k&r-exercises-807b4e70b1a286ac7fe1f28517c05805f428089c.tar.gz | |
4.13
Diffstat (limited to '4/13.c')
| -rw-r--r-- | 4/13.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -11,10 +11,9 @@ int main(int argc, char *argv[]) { char *s; size_t n; - s = malloc(MAXLEN); - n = sizeof(s); + s = malloc(sizeof(char) * MAXLEN); - getline(&s, &n, stdin); + fgets(s, MAXLEN, stdin); reverse(s, 0, strlen(s) - 2); printf("\t%s\n", s); |
