Hi!
I have recently started to learn C++ trough the tutorials on cprogramming.com and so far i find it really fun!
However, I am having some problems creating strings(stored in arrays) trough pointers.
Here is my code:
Now when i write a sentence, for example "Hello World" it will only print out the first character ("H").Code:char *arry; arry = new char[256]; cout<<"Please enter a string.\n"; cin.getline(arry,256,'\n'); cout<<"\nYour string has been saved, press enter to read it.\n"; cin.get(); cout<<*arry<<endl; delete [] arry; cin.get();
If i just declare an array and put the string in that array it will work just fine, so I am guessing that I am doing something wrong with the pointer.
Any help would be greatly appreciated!
//Mattias