知识库

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

2025-02-01 20:05:25 李腾 1 次阅读

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)));
}
转载请注明转自www.hylab.cn,原文地址:C语言开发示例:24. 字符串扩展

评论 (0)

登录后发表评论

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