A dynamic output array

Submitted by:Jhon Jhon

Date added:27 July, 2013

Category:C++

A dynamic output array by C++ Code

Tags: array , dynamic

Code Snippet:

#include <strstream>
#include <iostream>
using namespace std;
int main()
{
char *p;
ostrstream outs; // dynamically allocate array
outs << "C++ array-based I/O ";
outs << -10 << hex << " ";
outs.setf(ios::showbase);
outs << 100 << ends;
p = outs.str(); // Freeze dynamic buffer and return
// pointer to it.
cout << p;
return 0;
}
 
 

Comments