![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2005
Posts: 3
Rep Power: 0
![]() |
n00b question: size of a string?
I'm learning C++ and win32 using Dev-C++.
I wonder if there is a build in Fn to get the size of a string? eg: my string define as follow: char mystring[] = "this is my question?" Thanks. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jan 2005
Posts: 3
Rep Power: 0
![]() |
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
or
string mystring = "this is my question?" int x = mystring.length();
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
BTW, in case you're interested, strlen can be defined as:
int strlen (char *str)
{
for (int i = 0; *(str + i); i++);
return i;
} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|