Search This Blog

Wednesday, 2 March 2022

B1. C Program to find the length of a string without using built in function.

 /* B1. C Program to find the length of a string without using built in function */

#include<stdio.h>
#include<conio.h>
void main()
{
    char str[50];
    int i,length=0;
    clrscr();
    printf("Enter a string:\n");
    gets(str);
    for(i=0;str[i]!='\0';i++)
        length++;
    printf("Length of %s is %d\n",str,length);
    getch();
}

No comments :

Post a Comment

FREE Hit Counters