It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                已关闭8年。
            
                    
这是令人难以置信!

const char *cStr = "a";
printf("%s, %x", cStr, cStr);


结果:

a, 11046

最佳答案

它首先打印cStr指向的字符串,然后打印其地址。真的不是难以置信。

%x告诉printf期望一个十六进制值,并且由于您将指针传递给它,它将获取该地址并进行打印。

下列:

printf("%s, %x, %d", cStr, cStr, cStr);


还将以十进制格式打印地址。

10-08 08:20
查看更多