In my c++ code i want to write character array s[n] instead of writing s[10]. where n is size is the array, it is given by the user at the run time. But its not taking input. Its only taking n, not string.
I got the Output like this,
Enter size : 10
Enter String :
String :
    #include<iostream>
    #include<cstring>
    using namespace std;
    int main()
    {
       int n;
       cout<<"Enter size : ";
       cin>>n;
       char s[n];
       cout<<"Enter String : \n";
       cin.getline(s,n);
       cout<<"String : \n";
       int l=strlen(s);
       cout.write(s,l);
       return 0;
    }
 
    