Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on array of string operation within the C and C++ forums, part of the Software Development category; how do we find the string length without using strlen() function?...
|
|||||||
|
|||
|
array of string operation
how do we find the string length without using strlen() function?
|
| The Following 3 Users Say Thank You to shivaram.cunchala For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: array of string operation
There are many ways of doing it. Just running through the characters of the string inside a for/while loop will do the trick.
Cheers! Kalayama
__________________
[COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR] Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!" |
| The Following User Says Thank You to kalayama For This Useful Post: | ||
|
|||
|
Re: array of string operation
#include<stdio.h>
#include<conio.h? void main() { char ch[20];//to store string into the arry int i=0,length=0 while(ch[i]!='\0')// while arry not equal to null. String stores at the end as null { length+=1;//length=length+1 i++; } printf("The String length is",length); } |
|
|||
|
Re: array of string operation
could you please tell , what for len is used ............ without len we can get the ans
|
|
|||
|
Re: array of string operation
To find length of an array use this
int a; a=printf("12345"); /* a has length of string "12345" i.e 5 |
| The Following 2 Users Say Thank You to msubbums For This Useful Post: | ||
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Difference between String.Convert Vs String.ToString | jbanx | C# | 6 | 03-24-2008 12:02 PM |
| Active Screen Operation | Geek_Guest | QTP | 1 | 12-27-2007 08:01 AM |
| display string without having underscore if we send string with underscore | ausprem2000 | Oracle | 1 | 05-28-2007 06:46 AM |
| Object operation failed | Geek_Guest | Rational Robot | 0 | 04-16-2007 08:05 AM |
| How to make sure that the operation on database is successful? | sivaprasademani | SQL Server | 2 | 04-04-2007 01:03 AM |