bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / tuition-c / P066.c

P066.c (478B)


      1 /* WAP to find the length of a string using
      2     i) Library Method
      3     ii) User defined method
      4 */
      5 
      6 #include <stdio.h>
      7 #include <string.h>
      8 
      9 int sLength(char str[])
     10 {
     11     int i = 0;
     12     while (str[i] != '\0')
     13     {
     14         i++;
     15     }
     16     return i;
     17 }
     18 
     19 int main()
     20 {
     21     char str[30];
     22     int len;
     23     printf("Enter the string: ");
     24     gets(str);
     25     len = strlen(str);
     26     printf("Length of the string: %d", len);
     27     printf("\nLength of the string (U-D): %d", len);
     28     return 0;
     29 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror