在C / C C-字符串定义++ [英] C-string definition in C / C++

查看:124
本文介绍了在C / C C-字符串定义++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

真的词C字符串,在C / C的意思++?字符指针?字符数组?或字符常量可能指针/常量数组?

What really means by word "C-string" in C / C++? Pointer to char? Array of characters? Or maybe const-pointer / const array of characters?

推荐答案

一个C字符串是用0(空字符)字节结束的字符数组。该数组,而不是任何指针,是的字符串的。因此,C字符串的任何终端子阵也是一个C字符串。类型的指针的char * (或为const char * 等)通常被认为是指向字符串,但他们实际上会指向一个字符串的元素,通常作为指针的初始的字符串的元素处理。

A "C string" is an array of characters that ends with a 0 (null character) byte. The array, not any pointer, is the string. Thus, any terminal subarray of a C string is also a C string. Pointers of type char * (or const char *, etc.) are often thought of as pointers to strings, but they're actually pointers to an element of a string, usually treated as a pointer to the initial element of a string.

这篇关于在C / C C-字符串定义++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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