当我阅读Xtables的源代码时,我发现了类似的东西.
pr_info("SRC=" NIP6_FMR "DST=" NIP6_FMR "\n",
NIP6(iph->saddr), NIP6(iph->daddr));
Run Code Online (Sandbox Code Playgroud)
我想知道为什么字符串作为组合字符串处理,以及效果是由pr_info宏引起的,还是C规范的一部分.所以,我编写了这段代码并发现它是C规范中定义的行为.
int main(void) {
char a[] = "aaa" "bb";
printf("%s\n", a);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
规范在哪里定义?我不知道如何搜索规范以及用于表达行为的单词.
我做了一个树形结构,从文件中读取单词并将它们注册到树中.但是enter()不能正常工作.我用gdb进行了调试并设置了一个断点线42.然后我进入了print *node print *root.
(gdb) print node
$9 = (struct node *) 0x603250
(gdb) print *node
$10 = {left = 0x0, right = 0x0, word = 0x0}
(gdb) print root
$11 = (struct node *) 0x0
(gdb) print *root
Cannot access memory at address 0x0
Run Code Online (Sandbox Code Playgroud)
为什么没有root积分?为什么不node->word指出给定的词?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
struct node {
struct node *left;
struct node *right;
char *word;
};
static struct node *root = NULL; …Run Code Online (Sandbox Code Playgroud)