BinaryByter
its probably dependent on arch anyway so ¯\_(ツ)_/¯
Mihail
and I just assumed that there is a character that is called end of file
25 is EM (end of medium) on the ascii table you sent earlier
BinaryByter
yea
Mihail
Probably takes a different meaning in different cases
BinaryByter
but according to the other guy, EM is the end of the entire tape
Mihail
Well maybe you indicate whatever you want with it
Mihail
So in files it could be interpreted as EOF
Mihail
But in something else it could be interpreted as something else
BinaryByter
true
Mihail
And have EM only mean that something ended
BinaryByter
true
Mihail
You'd know if you opened a file or a tape, so you'd know what that end of something indicates
Nana
hello i'm a c++ programming beginner. A complete novice to programming. I need a basic concept to c++. please
Ибраги́м
https://www.reddit.com/r/Amd/comments/a9tjge/amd_rocm_hcc_programming_introduction/
S.
https://en.m.wikipedia.org/wiki/End-of-file
S.
Already explain clearly 👏
S.
By Wikipedia
S.
😑 human’s memory is just so unreliable...
BinaryByter
BinaryByter
well atleast variable that you create
BinaryByter
you CAN pass variables as pointers
BinaryByter
but that makes the vulnerable to you accidentally calling delete on them
Badugar
iirc new always returns a pointer
BinaryByter
yes it does
BinaryByter
but you shouldn't use new
BinaryByter
because suddenly you have the responsability for memory management
Anonymous
Use smart pointers instead
BinaryByter
avoid pointers in general
Badugar
smart pointers ?
BinaryByter
unless you need em for polymorphism
Anonymous
I don't think thats a good advice. Avoid raw pointers. If a pointer is the correct choice, you should use it. But the correct way.
BinaryByter
classes that do memory management for you
Anonymous
smart pointers ?
https://en.cppreference.com/book/intro/smart_pointers
Anonymous
a pointer is seldomly the correct choice
Sometimes you need to use a pointer. I'm a not a big fan of avoiding a specific part of a language and writing very inefficient and ugly code instead.
Anonymous
If you don't need a pointer, don't use one, thats true
BinaryByter
thats why as a general rule I say "don't use pointers"
Anonymous
But if your code gets ugly and inefficient, nope
BinaryByter
if you understand the implications, sure break it
BinaryByter
But if your code gets ugly and inefficient, nope
how often does that happen because you don't use a pointer?
Anonymous
If pointers were not important nobody would add to the language
Anonymous
how often does that happen because you don't use a pointer?
Not very often. But that doesn't mean this case will never happen.
BinaryByter
If pointers were not important nobody would add to the language
they are important but they were wrapped by so many classes in the standard library that you usually don't need them
Anonymous
But I agree with you, that you never should use a pointer if you don't need one
BinaryByter
yes, thats what I meant
Anonymous
Hello! I have 3 numbers that I want to sort in ascending order. I tried with using lots of if else cases to test f numbers are bigger or smaller yet I feel that this is a horrible solution.
Anonymous
How can I do this more 'elegantly'?
BinaryByter
it is one
BinaryByter
I would put them into a std::vector of ints
BinaryByter
and call std::sort on it
Anonymous
The thing is I haven't learned what a vector is 😞
BinaryByter
do you use C++?
Anonymous
Yes, just started learning it.
BinaryByter
okay
BinaryByter
a std::vector is a construct
Anonymous
Vector === array?
BinaryByter
you can put as many variables into it
BinaryByter
Vector === array?
its an array that doesn't have a fixed size
BinaryByter
std::vector<datatype> myVector;
BinaryByter
then you put your variables into it
BinaryByter
myVector.push_back (1);
BinaryByter
myVector.push_back (143);
BinaryByter
then you call sort on it
BinaryByter
std::sort (myVector.begin(), myVector.end());
BinaryByter
voila
BinaryByter
you have to include <vector> and <algorithm>
Anonymous
Thank you very much Maximilian
Anonymous
Is there also a place where I can read more about vectors? I know I need to Google but, I feel like a lot of documentation sites are just...trash
BinaryByter
Sure :D
Anonymous
In the sense that there are just google ads everywhere and not a lot of relevant content
BinaryByter
http://www.cplusplus.com/reference/vector/vector/?kw=vector
BinaryByter
cplusplus.com is a very very good place
Anonymous
Thanks again!
BinaryByter
Sure :D