c++ - 在堆上写文本 - 这是什么意思?x[计数++] = c;
问题描述
我正在研究在堆上写入文本的代码:
#include <iostream>
using namespace std;
int main() {
char c;
int count{0},d{0};
char *x;
x = new char[1000];
if(x != NULL){
cout << "enter the text,ending with by eof marker" << endl;
for(count=0; count!=cin.eof()&&count<1000;){
cin >> c;
if(!cin.eof())
x[count++] = c;
}
for(int d=0; d<count;d++)
cout << *(x+d);
cout << "end of text" << endl;
}
我在理解这个片段时遇到了问题:
x[count++] = c;
谁能给我解释一下?
解决方案
推荐阅读
- angular - ng2-file-upload 多个文件到不同的 URL,但使用相同的 Uploader
- python - 创建多个数据框列,其中包含来自现有列的计算值
- c# - 在 C# 和 iText 7 中使用 x509Certificate2 创建 IExternalSignature
- c# - PDF修改在C#中需要时间
- google-sheets - bigQuery Google Drive 使用 googleSheetsOptions 范围查询多个工作表
- c# - 运行代码时没有出现winform
- reactjs - How can one extend React types to support html attributes as props?
- sass - 如何将 SCSS 十六进制值转换为字符串,以便用于 CSS 类名?
- output - Pi2 GPIO 仅输出 4.7v
- javascript - 有没有办法更有效地扁平化这个承诺链(涉及链式捕获)?