Fix typo in comments

./strings/c-or-cpp/count-words.c:47: returing ==> returning
pull/185/head
Arsenic 2021-04-15 11:24:06 +05:30 committed by GitHub
parent cf1bc4692f
commit 1b2260be77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* Program to find the total numbers of words in a sentence */ /* Program to find the total numbers of words in a sentence */
#include<stdio.h> #include <stdio.h>
#include<string.h> #include <string.h>
#include<stdlib.h> #include <stdlib.h>
//Function which calculate and return total numbers of words //Function which calculate and return total numbers of words
int count_words(char *sen) int count_words(char *sen)
@ -33,6 +33,7 @@ the last index no. contain null and null is not alphabet so we not need to treat
} }
return word; return word;
} }
//driver code //driver code
int main() int main()
{ {
@ -44,7 +45,7 @@ int main()
if(sen==NULL) if(sen==NULL)
{ {
fprintf(stderr, "malloc() failed to allocate memory\n"); fprintf(stderr, "malloc() failed to allocate memory\n");
// returing 1 to tell that the program didn't run successfully // returning 1 to tell that the program didn't run successfully
return 1; return 1;
} }
printf("Enter a sentence: "); printf("Enter a sentence: ");
@ -57,6 +58,7 @@ int main()
//printing the total words //printing the total words
printf("Total number of words: %d",res); printf("Total number of words: %d",res);
} }
/* /*
Test case 1: Test case 1:
Input: Enter a sentence: DSA is a Important Topic Input: Enter a sentence: DSA is a Important Topic