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)

Posted By: Aaliyah Khan     Category: C Programming     Views: 2594

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) 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 : World

     THE STRING LENGTH OF World IS 5  .


*****************************************************************************
  
Share: 



Aaliyah Khan
Aaliyah Khan author of Program to find the length of a string taken from user (without using strlen) is from Karachi, Pakistan.
 
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!