From ce8bb23e3e50b3e9c049b95b20a776d0f41640d5 Mon Sep 17 00:00:00 2001 From: namankunder <72254845+namankunder@users.noreply.github.com> Date: Fri, 2 Oct 2020 15:51:55 +0530 Subject: [PATCH] Update length of a string --- length of a string | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/length of a string b/length of a string index 810e5cd..9e60c22 100644 --- a/length of a string +++ b/length of a string @@ -4,8 +4,8 @@ int main() char s[1000]; int i; printf("Enter a string: "); - scanf("%s", s) - for(i = 0; s[i] != '\0'; ++i) + scanf("%s", s); + for(i = 0; s[i] != '\0'; ++i); printf("Length of string: %d", i); }