previous | start | next

C String: Dynamic C String

int main()
{
  char s[132];

  cout << "Input a sentence on one line" << endl;
  cin.getline(s,132);
  char *m = new char[strlen(s) + 1];

  strcpy(m, s);

  cout &lt;&lt; m &lt;&lt; endl;
  ...

  delete [] m;

}
Output: (the input sentence)


previous | start | next