answersLogoWhite

0


Best Answer

strlen is the C library function that accepts a pointer to a char array and returns an integer specifying the number of characters (in bytes) of the array. This function is usually not used any more, because it does not support multi-byte characters, such as UTF-8.

User Avatar

Wiki User

βˆ™ 12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which take a string as input and find its length?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a program to input a string in the form of name and swap the initials of the namefor example enter a string is rohit Kumar sharma and should be printed RK Sharma?

Get the string from user , then U Split the string with space and put in a string array .Then Find Length of string array , Take first letter of each element in array, Except last. Assigned those to a string, then Fetch Last element of an array, Add it With that String.That's it.


How do you scramble a string in java?

Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.


An assembly language program that will take three decimal input and display minimum of them?

program that take three decimal number as input and find the largest among them in assembly language


Write a program in c plus plus to accept the string and then take the starting and ending point from the user and display the sub string through function?

#include<iostream> #include<sstream> unsigned input_num (std::string prompt, unsigned min, unsigned max) { unsigned num = 0; while (1) { std::cout << prompt << " (range " << min << " - " << max << "): "; std::string input = ""; std::getline (std::cin, input); std::stringstream ss (input); if (ss >> num) { if (num >= min && num <= max) break; else if (num<min) std::cout << "Index must be greater than or equal to " << min << std::endl; else std::cout << "Index must be less than or equal to " << max << std::endl; } else std::cout << "Invalid input." << std::endl; } return (num); } void print_substring (std::string input, unsigned left, unsigned right) { std::cout << input.substr (left, right - left + 1) << std::endl; } int main() { std::cout << "Input string:\t"; std::string input = ""; std::getline (std::cin, input); unsigned left = input_num ("Enter the start index of the substring", 0, input.size()-1); unsigned right = input_num ("Enter the end index of the substring", left+1, input.size()-1); print_substring (input, left, right); }


Write a C program to find the abbreviation of a full name without using string library function?

//C++ program to abbreviate first and middle name#include#include void main(void) { char name[40]; char abname[30]; int i,len,m=1,j=0; //puts is used to print string of characters //although cout is equivalent to it but gets //and cout should not be mixed in one program puts("Enter Name: "); //gets is used to take string input with spaces gets(name); //strlen is a built-in function, declared in //the string.h header file //it returns the length of a string len=strlen(name); abname[j++]=name[0]; abname[j++]='.'; abname[j++]=' '; for (i=0;i

Related questions

Write a program to input a string in the form of name and swap the initials of the namefor example enter a string is rohit Kumar sharma and should be printed RK Sharma?

Get the string from user , then U Split the string with space and put in a string array .Then Find Length of string array , Take first letter of each element in array, Except last. Assigned those to a string, then Fetch Last element of an array, Add it With that String.That's it.


Program to find the size of the string without using string functions?

You can't. If you want to find the length of a String object, you must use at least one of the String methods. Simply iterate over your char* and count the number of characters you find before you reach the null character . int strLength(const char* str) { int length = 0; // take advantage of the fact that all strings MUST end in a null character while( str[length] != '\0' ) { ++length; } return length; }


What is the diameter of a 6 liter wine bottle?

Take a string, wrap it around the wine bottle once, and measure the length of the string.


How do you measure the length of your hair?

I find the best way is to get a piece of string and place it at the top of your head. Pull it tight and measure out where the average lenght of your hair is. Then measure the string, to find the actual length. Otherwise, a pretty easy (but less exact) way is to take a ruler, place it against the side of your head with the 0 inches at the top of your head and measure to where your hair falls.


How can you find the circumference of the quarter without using the math formula?

The circumference of any circle is the distance around the outside. You can take a piece of string and measure the outside of the quarter. See how much string fits around the outside. Then put that length of string up against the edge of a ruler and see how long it is.


How do you scramble a string in java?

Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.Take out one letter, using a random number. Then replace the string with the new string, without the extracted letter. Repeat, until the remaining string has a length of zero. The extracted letters get added to a new string.


How do you find the perimeter of a human?

You take the human in question and have him or her lie down on a bed, then you take a fairly long piece of string or twine and lay it next to that person as closely as you can, all along his or her perimeter, then snip it off so that it is the length of that perimeter. Then, you can straighten out the piece of string and measure it with a ruler or tape measure.


Why does the length of string affect a pendulum?

The length of the string in a pendulum affects the period of its swing. A longer string will have a longer period, meaning it will take more time to complete one full swing. This is due to the increased distance the pendulum has to travel, leading to a slower back-and-forth motion.


How to write a program in python to print the reverse of a number?

In python, type the following into a document. NOTE: Sentences following a # symbol are comments, and are not necessary for the program to run. #!/usr/bin/python #This program takes a input from a user and reverses it. number = input("Type a number: ") #This takes input from a user. a = len(number) #This finds the length of the number reverse = "" #This sets the variable reverse to an empty string. for i in number: a = a-1 #The places in a string start from 0. The last value will be the length minus 1.reverse = reverse + number[a] #Makes the number's last digit the new string's first. print("The reverse of", number, "is", reverse + ".") #prints the resulting string. This program will take any sequence of characters and reverse them. The final value is a string, but if an integer is needed, one needs only to add the line reverse = int(reverse) above the print statement. However, this will stop the program from being able to reverse strings, as it is not possible to convert a string to an integer if it is not a number.


How do you take pounds off your 50 pound Long bow so you can shoot better?

Increase the length of the string.


How would you find the width If you have the length and area?

take Area/Length


In a bit string length 12 How many begin with 11001?

Considering that 5 are static.....take the remaining:2^7 = 128