answersLogoWhite

0

/* with run-time library */

int len;

char* str;

len = strlen (str);

/* without run-time library */

int mystrlen (const char* str) {

int len;

while (*str != '\0') {

len++;

str++;

}

return len;

}

int len;

char* str;

len = mystrlen(str);

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Write a program to find the length of a string in shellscript?

This is an assignment not a question.


How to write A Java program to print number of digits in a given number?

One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.


Write the program in Linux to find the reverse of any string?

i am sam


How do you write a c program to find a word in a string?

what is if(!(str[i]==32))


How do you write a c program to find the smallest word in a string?

what is if(!(str[i]==32))


Do I need to write a program to find a substring in a given string in c plus plus?

No.


Write a c program using string concept enter a sting and replace the new string in to old string and find no of occurrence?

print c co com comp compu


How do you write a program to find the no of words in a given string in dot net?

You find a language that can be targeted towards the .NET Framework. What you are suggesting is something related to string manipulation and you can work with delimiters.


1 Write a program to find the length of a string c plus plus?

#include<iostream> #include<string> int main() { std::string s("The quick brown fox jumps over the lazy dog"); std::cout<<s.c_str()<<std::endl; std::cout<<"The previous string is "<<s.size()<<" characters long."<<std::endl; }


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; }


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.


Find length of the string without using loops and control structures?

length = strlen(string);

Trending Questions
Why CNC instead of lathe? How do you take the nccer test online for scaffolding? Can you make a diesel engine which works on the basic principle of petrol engine or you can say it uses diesel as a fuel but works on the principle of petrol engine? If an appliance is metal how does the earth wire and fuse protect both the appliance and user? In what class lever is the resistance arm always longer than the force arm? What two simple machines make up a screw? What do you call a person who improves objects? Explain formula volume expansion coefficient subject expansion of solid? How are n-type and p-type semiconductors similar? I wanted the theory for implementation of full adder using 3 to 8 decoder and 4 input nand gates? What is a number less than zero called? Why did Andrew carnegie begin working with steel? How can nanotechnology be applied for the benefit of humankind? What the the requirements to get it certification? Which type of fourth-generation language tools are end-users most likely to work with? What is the difference between first class and second class stamps? Are there 'Kannada medium student's quota' and 'rural Karnataka student's quota' in engineering colleges of Karnataka - are these quotas only in government engineering colleges? What does SFA stands for in welding? How much it cost to build Piper Alpha oil platform? Which of these elements is NOT common to all programming languages. A. set of operators B. structured classes C. supported data types or D. rules of syntax?