Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to find the length of a string taken from user without using strlen function

Posted By: Viveka Fischer     Category: C Programming     Views: 15232

Write a program to find the length of a string taken from user (without using strlen)

Code for Program to find the length of a string taken from user without using strlen function in C Programming

#include<stdio.h>
#include<conio.h>
void main()
{
    char a[50];
    int i,j;
    clrscr();
    printf("\n Please Give The STRING : ");
    scanf("%s",a);
    for(i=0,j=0;a[i]!='\0';i++)
        j++;
    printf("\n THE STRING LENGTH OF %s IS %d .",a,j);
    getch();
}


--------------------------------- OUTPUT ---------------------------------




 Please Give The STRING : Example


 THE STRING LENGTH OF Example IS 7.



--------------------------------------------------------------------------
  
Share: 



Viveka Fischer
Viveka Fischer author of Program to find the length of a string taken from user without using strlen function is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!