如何以超过256字节的时间打印字符串作为char数据类型? [英] How to print the string at a time more than 256 bytes as char data type?

查看:114
本文介绍了如何以超过256字节的时间打印字符串作为char数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印像小文档一样大的字符串,但我不能存储所有字符串,因为字符类型范围最多为256.有什么方法可以显示吗?



我尝试了什么:



我是c编程的新手..我不知道如何继续..我认为我可以使用结构吗?

I want to print the string which is larger like small document but I can not store all the string because the char type range is up to 256. is there any way to display?

What I have tried:

I am new to c programming .. i don't know how to proceed.. i thought can i use structures?

推荐答案

字符串由char值组成:它是一个字符数组,通常以空字符结尾。 br />
虽然每个字符只能在0到255的范围内(除非你的嵌入式系统实现了Unicode,这似乎不太可能),但对数组的大小没有这样的限制 - 它的大小仅限于通过嵌入式系统中数组索引的大小(这些天通常是32位整数,但在较旧的系统中可能是16位)。



唯一的东西你不能做的是将字符串的长度(如果有的话)存储在一个字符中 - 但只要你知道ep在整数中,你应该没事。
A string is made up of char values: it is an array of chars, normally terminated by a null character.
While each character can be only in the range of 0 to 255 inclusive (unless your embedded system implements Unicode, which seems unlikely) there is no such restriction on the size of the array - it's size is limited only by the size of an array index in your embedded system (normally 32 bit integers these days, but may be 16 bit in much older systems).

The only thing you can't do is store the length of the string (if any) in a single character - but as long as you keep that in an integer, you should be fine.


这篇关于如何以超过256字节的时间打印字符串作为char数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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