String Length Calculation

#include <stdio.h>
#include <string.h>

int main() {
    // String length calculation
    char text[100];

    printf("Enter a string: ");
    scanf("%s", text);

    int length = strlen(text);
    printf("Length of the string: %d\n", length);

    return 0;
}
chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website