String constant stitching on the C language

Record issues:

C language, strings Can I create edited directly spliced ​​together by a continuous constant?

For example, the following assignment statement:

const char *path = “this is string one”   “this is string two”;

 

verification:

 1 #include <stdio.h>
 2 
 3 #define AVAGO_FIRMWARE_PATH "/avago/firmware/"
 4 
 5 int main(void)
 6 {
 7     // int phy_id = 0;
 8     // int serdes_mode_line_1 = 0;
 9 
10     const char *path;
11     const char *fw_rev;
12     fw_rev = "0";
13     path = AVAGO_FIRMWARE_PATH "sbus_master/%s/sbus_master.%s_%s.rom" "\n";
14     printf(path,fw_rev,fw_rev,fw_rev);
15 
16     return 0;
17 }

 

 


 

After the result of the program as shown below:

Three sections did not add any production string connected to symbols, and stores the continuous string constants assigned to the address pointer path.

Guess you like

Origin www.cnblogs.com/yochingbox/p/12051534.html