diff options
| author | mo k <mo@mokhan.ca> | 2012-02-17 21:12:17 -0700 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-02-17 21:12:17 -0700 |
| commit | ed95723ec68282031d9335f5f3180863bc0b6ca4 (patch) | |
| tree | d8467bb51e3b9e7ae90c71ec8f50887436f213aa | |
| parent | 95b479d73faea6f250f18be3fbce76839d6c0d56 (diff) | |
replace scanf with gets.
| -rw-r--r-- | src/main.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -3,10 +3,8 @@ #include <string.h> void reverse(char* input){ - char *start, *end, tmp; + char *start = input, *end, tmp; - start = input; - printf("%zu \n",strlen(input)); end = &input[strlen(input)-1]; while(start != end){ @@ -23,10 +21,8 @@ int main(int argc, const char *argv[]) { char input[128]; - memset(&input, 0, sizeof(input)-1); printf("enter a string to reverse: "); - scanf("%s", input); - + gets(input); reverse(input); printf("%s", input); |
