小编Ani*_*mar的帖子

将NULL传递给printf%s

#include<stdio.h>
#include<string.h>

int main() {
    char *ptr = NULL;

    printf("%s", ptr);//The output is null
    //  printf("%s\n", ptr); //addition of **\n** give segmentation fault 

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

第一个printf输出:(null).但为什么第二个printf产出是: Segmentation fault (core dumped)只是添加:\n

c

1
推荐指数
1
解决办法
1344
查看次数

正则表达式查找a和b的所有字符串,其中包含偶数个和偶数个b?

是否可以使用正则表达式计算字符串中出现字符的次数?可以给出任何正则表达式来查找a和b的所有字符串,其中包含偶数个和偶数个b吗?

regex

-1
推荐指数
1
解决办法
1453
查看次数

标签 统计

c ×1

regex ×1