STUDENTS 3K

  • Home
  • Students+
    • Engineering Students
    • Education Loan
    • Study Abroad Guide
    • Projects Download
  • Freshers
    • Aptitude Q & A
    • Placement Papers
    • Verbal Ability
    • Interview Questions
    • IT Company Details
    • Job Updates
  • Study Resources
    • Career Guidance
    • LAB Programs
      • C Programs
      • CPP Programs [C++]
      • Java Programs
    • Question Papers
    • Learn English
    • Notice Board
  • More –>>
    • Love calculator
You are here: Home / Important Programs / Find Length of String using C program

Find Length of String using C program

C program to find the length of a string without using a strlen method. This is a simple source code to learn easily. This code can calculate the count of a given input string. Sample coding is given below for your reference.

  • Convert fahrenheit to celsius in C programming

FINDING LENGTH OF STRING IN C

This C program is used to find the characters count of a given string value by using the unconditional statement. For example, take a “program” as an input string value. Then the code will display an output as 7. In this program null characters will not be considered.

  • Bubble sort program in C using arrays
  • Game coding in C program

C CODE:

Q: How to find the length of an input string without using a strlen method.

//Header file section
#include<stdio.h>
void main()
 {
  Clrscr(); //Function to clear previous output
  //Program variables
  char sr[25];int ct=0;
  int j=0;

  printf("enter the string"); //Display function
//  for(j=0;j<25;j++)
  scanf("%s",sr); //Getting input function
  while(sr[j]!='\0') //Unconditional statement
  {
    printf("%c",sr[j]);
    i++;
    count++;
  }
  printf("length of string=%d",ct);
getch();
}

Filed Under: Important Programs Tagged With: C, LAB, Programs





Random Materials :

  • Data Mining and Data Warehousing
  • Difference Between Class and Primitive Types
  • Database Roles in SQL
  • CASE Expression in SQL
  • Concurrent Update Problem

Follow Us on Facebook

Advertisement

Company Profile

  • About Students3k
  • Contact Us
  • Earn Money Online
  • Website Archive Page
  • Privacy Policy
  • Disclaimer

Categories

  • Important Programs
  • Study Abroad
  • IT Companies
  • Career Guidance for Students
  • Teachers
  • Verbal Analogies

We Are Social

  • Facebook Fans
  • Twitter Follow
  • Google Plus
  • Pinterest Page

© Copyright 2012 - 2016 Students3k.com · All Rights Reserved · Designed By Benefits

Show