Slip 26 - A) Write a C program to calculate length of string without using standard functions.

Solution:


#include <stdio.h>
int main()
{
    char s[1000];
    int i;

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

    for(i = 0; s[i] != '\0'; ++i);

    printf("Length of string: %d", i);
    return 0;
}

Post a Comment

0 Comments