hi, length/size of a pointer to a string? how?
ie,
char* ptr;
cin >> ptr;
// now how do i get the size of ptr now?
thanks!
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
The size of the pointer sizeof(ptr). Here should be 4.
The size of the pointee sizeof(*ptr). Here should be 1.
The size of a C string strlen(ptr). String must be null-terminated.
The size of a C++ string str.length().
Note: sizeof will not give you the total size of an array unless you are applying it directly to the array itself (as opposed to a pointer which happens to point to the array).
The size of the pointee sizeof(*ptr). Here should be 1.
The size of a C string strlen(ptr). String must be null-terminated.
The size of a C++ string str.length().
Note: sizeof will not give you the total size of an array unless you are applying it directly to the array itself (as opposed to a pointer which happens to point to the array).
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
wow, thanks, strlen() oh yeah..,
cya fruny,
cya fruny,
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
btw, how can i use TextOut() to output a blank space?
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
I don''t know. RTFM.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
RTFM?
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
quote: Original post by mickey
RTFM?
Here, my clueless newbie friend. Reading what I just gave you will make you a much wiser man, and it will save you from getting flamed too. It''s quite lengthy, but trust me, it''s for your own good.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement