Original article address:Convert: char *,
Char []
, Cstring,
String Conversion
Author:Gisldq
(1) OverviewString and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been
Ansi c provides three types of characters: Char, signed Char, and unsigned char. There are only two types of characters like short and INT (INT is unsigned int by default ).
Each of the three occupies 1 byte. Therefore:
The value range of signed
First, start
One of the troubling questions today is the difference between Char and signed char, unsigned char. between two or three people
1.ANSI C provides 3 character types, namely Char, signed char, and unsigned char. Instead of just two types
Reprint Address: http://hi.baidu.com/thewillreigns/blog/item/67e665c4296e69c038db492d.html
Char and unsigned char are unsignedBoth are used words as words that are indistinguishable, but when integers are used differently:Char integer range is-128
This article comes from the network source: Click me
There is such a piece of code:
#include "stdio.h"char *get_string_1(){ char p[] = "hello world!"; return p;}char *get_string_2(){ char *p = "hello world!"; return p;}int main(){
(1) Overview
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedef cstringt> cstring) is the most common
Comparison of cstring, string and char *
(1) Overview
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedef
String and cstring are both string template classes. string is a string class defined by the standard template class (STL) and has been incorporated into the C ++ standard;
Cstring (typedefCstringt> cstring) is visualC ++ is the most common string
Reprinted. char * P = "Hello world! "; Content in" "is in the static Zone
But some people say it is in the constant area.
The memory occupied by a C/C ++ compiled program is divided into the following parts:1. STACK: the stack zone is automatically
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.