To find the length of the string using pointers

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    char *str;
    int len = 0;
    clrscr();
    printf("Enter a string : ");
    scanf("%s", str);
    while(*str != '\0')
    {
        len++;
        str++;
    }
    printf("\nThe length of the string is : %d", len);
    getch();
}

Output:

Enter a string : bhuvan
The length of the string is : 6