I am confused between things like char* v and char v, and how to use them.
I heard that C++ doesn't use things like char* v. Is that true ?
User Profile
Collapse
-
oops...I forgot to write the file.open line when I typed this post.
Initially, I read that new can be used to provide a varying memory size for the pointer it's refering to. So, that's why I wrote str = new char; How then should I use new ?
If my code is only allocating one byte space for str, I don't understand how I could manage to cout 123. If it's one byte, shouldn't it cout 1 ? And why should a pointer read less one byte... -
Parameter not working
I have written a C++ as I learn C++ along, and the funny thing is that this C++ I wrote, just have to open a txt file, and reads it and cout the content.
The txt file (new.txt) content is 12345.
But the output that I got once compiled was 123. I can't figure out why 45 doesn't appear. If I revert to char str[12]; it outputs 12345. I dunno what's wrong with my code below:
#include <iostream>
#include <fstream>...
No activity results to display
Show More
Leave a comment: