C语言开发示例:24. 字符串扩展

2024-07-10 李腾 48 次阅读 0 次点赞

string_ext.c

#define __STDC_WANT_LIB_EXT1__ 1

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

int main()
{
#if defined __STDC_LIB_EXT1__
    printf("Optional functions are defined.\n");
#else
    printf("Optional functions are not defined.\n");
#endif

    char str[100] = "Hello, world";
    printf("len: %d", strnlen(str, sizeof(str)));
}
本文由人工编写,AI优化,转载请注明原文地址: C语言开发示例:24. 字符串扩展

评论 (0)

登录后发表评论

暂无评论,快来发表第一条评论吧!