(int *)???
calloc() ???
free() ??
Did you see the sign on the door when you came in? This is a C++ forum.
---------
^^note cliEls versus liEls.
i'm trying to learn c++
First lesson: use simple, clear variable names. It appears that picking non-confusing variable names is not your strong suit at this point, so stick with single letters of the alphabet until you get the hang of it.
C++ allows you to dynamically create arrays at runtime. Here is how it is done:
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int s;
cout<<"Enter the array size: ";
cin>>s;
string* ptr = new string[s];
for(int i = 0; i < s; i++)
{
cout<<"Enter some text: ";
cin>>ptr[i];
}
for(int j = 0; j< s; j++)
{
cout<<ptr[j]<<endl;
}
delete [] ptr;
return 0;
}