File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#include <stdio.h>
22
33//Created a function to calculate length of string.
4- int LengthOfString (char string [50 ])
5- {
4+ int LengthOfString (char StringInput [50 ]){
65 int length = 0 , i ;
7- scanf ("%[^\n]" , string ); //Input of the string
6+ scanf ("%[^\n]" , StringInput ); //Input of the string
87
9- for (i = 0 ; string [i ]!= '\0' ; i ++ )
10- {
11- length ++ ;
12- }
8+ for (i = 0 ; StringInput [i ] != '\0' ; i ++ )
9+
10+ length ++ ;
1311
1412 return length ;
1513}
1614
17- int main (void )
18- {
19- char string [50 ];
15+ int main (void ){
16+ char sentence [50 ];
2017 int length ;
2118
22- length = LengthOfString (string ); // Using the function
23- printf ("%d \n" , length ); // Printing the length
19+ length = LengthOfString (sentence ); // Using the function
20+ printf ("%d \n" , length ); // Printing the length
2421
2522 return 0 ;
2623}
You can’t perform that action at this time.
0 commit comments