在 C 中查找字符数组的长度 [英] Finding the length of a Character Array in C

查看:43
本文介绍了在 C 中查找字符数组的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 C 中有什么方法可以让人们找到字符数组的长度?

What is a way in C that someone could find the length of a character array?

我很乐意接受伪代码,但我并不反对有人愿意写出来:)

I will happily accept pseudo-code, but am not averse to someone writing it out if they'd like to :)

推荐答案

前提是char数组以null终止,

Provided the char array is null terminated,

char chararray[10] = { 0 };
size_t len = strlen(chararray);

这篇关于在 C 中查找字符数组的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆