I'm studying a code that writes text on the heap:
#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;
}
I have a problem understanding this snippet:
x[count++] = c;
Can anyone explain it to me?