using codeblocks
---------------------------------------------------------------------------------------------------------------
// program to get length of a string // title of program
#include <stdio.h> // header file to control input and output
#include<string.h> //header file to handle string function
void string_length(); // function prototype
int main() // main function returning integer value
{
string_length(); // function calling
return 0; // returning value 0
}
void string_length() // function body
{
char string[100]; // string declaration
puts("enter string"); // message declaration
gets(string); // gets string from user
printf("length=%d",strlen(string)); // displays length with the help of strlen() function
}
---------------------------------------------------------------------------------------------
using turbo c++
---------------------------------------------------------------------------------------------------------
// program to get length of a string // title of program
#include <stdio.h> // header file to control input and output
#include<string.h> //header file to handle string function
#include<conio.h> // header file to control console input and output
void string_length(); // function prototype
int main() // main function returning integer value
{
string_length(); // function calling
getch(); // holds input and output
return 0; // returning value 0
}
void string_length() // function body
{
char string[100]; // string declaration
puts("enter string"); // message declaration
gets(string); // gets string from user
printf("length=%d",strlen(string)); // displays length with the help of strlen() function
}
using turbo c++
---------------------------------------------------------------------------------------------------------
// program to get length of a string // title of program
#include <stdio.h> // header file to control input and output
#include<string.h> //header file to handle string function
#include<conio.h> // header file to control console input and output
void string_length(); // function prototype
int main() // main function returning integer value
{
string_length(); // function calling
getch(); // holds input and output
return 0; // returning value 0
}
void string_length() // function body
{
char string[100]; // string declaration
puts("enter string"); // message declaration
gets(string); // gets string from user
printf("length=%d",strlen(string)); // displays length with the help of strlen() function
}