One, possible combinations:(1) Const CHAR*P(2) Char Const*p(3) Char *const p(4) const char **P(5) Char Const**p(6) Char *const *p(7) Char **const pOf course, in (5), (6), (7) and then insert a const in a number of cases, but the analysis of the
I. Possible combinations:
(1) const char * P
(2) Char const * P
(3) char * const P(4) const char ** P
(5) Char const ** P
(6) char * const * P
(7) Char ** const P
Of course, there are several cases of inserting a const in (5), (6), and
See the Forum on the discussion of this issue, the feeling is also involved in a relatively broad, and many people have made this mistake, such as declaring char *p = "Hello world!"; I tried to change the string content with the P pointer, so I
Hello world, as the beginning of all programming languages, occupies an immutable position, all the Chinese/English/French/German/American ... Version of the programming textbook, Hello World is always recorded as the first Test in the book, all the
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
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(){
In the function, char P [] = "Hello World" and char * P = "Hello World" have different effects. Why? Please let us know!
Please refer to two
Program :
(1)
Char * getstring (void)
{
Char P [] = "Hello World ";
Return P;
}
Void main ()
{
Char * STR
Create a working directory Go-examples for the Go program, with an absolute path of/home/go-examples. Start writing our first down program.
First, create a file under the Go-examples hello.go
Copy Code code as follows:
Hello.go
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.