Search
 
SCRIPT & CODE EXAMPLE
 

C

How to get the number of characters in a string without using strlen function

#include <stdio.h> 
int length_of_string(char *s) {
    int count = 0;

    while (s != '') {
        count++;
        p++;
    }

    return (count);
}
/**
 * main - check the code
 *
 * Return: Always 0.
 */
int main(void)
{
    char *str;
    int len;

    str = "My first strlen!";
    len = _strlen(str);
    printf("%d
", len);
    return (0);
}
Comment

PREVIOUS NEXT
Code Example
C :: how to compress image in c 
C :: fscanf stops at space 
C :: difference between %f and %lf 
C :: C Relationship Between Arrays and Pointers 
C :: inline function in c example 
C :: print binary in c 
C :: gsl matrix invert 
C :: how to get a string input in c 
C :: function pointer in c 
C :: bucket sort 
C :: linked list in c 
C :: compile opencv program 
C :: c program for determining a character is alphabet or not 
Dart :: how to diable flutter for web 
Dart :: How to attach a FloatingActionButton to the AppBar 
Dart :: flutter keyboard overflow when opens 
Dart :: flutter print type 
Dart :: italic text flutter 
Dart :: flutter run code after build 
Dart :: taskkill dart 
Dart :: refresh indicator flutter 
Dart :: string to double dart 
Dart :: underline text flutter color 
Dart :: random number dart with length 7 
Dart :: flutter flotingactionbutton extend 
Dart :: text field validation in flutter 
Dart :: get one document firestore flutter dart 
Dart :: elevatebutton in flutter 
Dart :: dart store unique values 
Dart :: dart custom exception 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =