Calculate length of the string without using library functions

C program to calculate length of the string without using library functions.

Program

#include<stdio.h>
#include<conio.h>
#define MAX 50

void main()
{
	char str[MAX];
    int i, len;

    printf("Enter the string\t:");
    gets(str);

    len = 0;
    i = 0;
    while(str[i] != '\0')
    {
        len++;
        i++;
    }

    printf("\nLength of the string you entered is %d",len);

    getch();
}

Output

Enter the string        :welcome to coursecrux.com

Length of the string you entered is 25