You explain everything so calmly, perfectly, it's def. easier to understand with you explaining it, thank you.
@ProfessorHankStalica9 ай бұрын
Glad it was helpful!
@j_naimi6031 Жыл бұрын
reading the book made it look hard for me, you made it clear in less than 3 minutes for me, thank you edit: u got me as a subscriber i love you bro keep doing your thing
@ProfessorHankStalica Жыл бұрын
Awesome, thank you!
@surojitnath3336Ай бұрын
That's one of simple explanation I have seen, Thanks for the video :)
@ProfessorHankStalicaАй бұрын
Glad it was helpful!
@zhalynkabyken3765 Жыл бұрын
Great stuff!
@ProfessorHankStalica Жыл бұрын
Glad you think so!
@seven-xl2225Ай бұрын
you solved my life problem , THX bro
@Madhav-uq1tm2 ай бұрын
Thank you sir❤
@ProfessorHankStalica2 ай бұрын
So nice of you
@oussamabouallati5 ай бұрын
Thank you sir
@_4p_9 ай бұрын
Thank you sir.
@ProfessorHankStalica9 ай бұрын
Welcome!
@TheRawi6 ай бұрын
Thanks for this video. I have a question about multiple casting Here is an example: int array[5]{}; array[0] = 1; array[1] = 2; Is it possible to keep the pointer arithmetic here as "int" but assign only a byte? So that "= 1" and "= 2" would be treated as a single byte/char instead of an int.
@ProfessorHankStalica6 ай бұрын
You could store the 1 or 2 in a char variable, or you could use bitwise operators to store 1 in the high byte and 2 in the low byte of an unsigned short, for example.
@TheRawi6 ай бұрын
@@ProfessorHankStalica Thanks for the answer. I tried to assign it to a temporary variable of type char then assign it, the same result; the compiler still treats it as an int and so the other 6 bits are filled with zeros. What worked for me is this: *(char*)(int*)&array[0] = 1; *(char*)(int*)&array[1] = 2; Here the pointer arithmetic is maintained but only a single byte is copied but I'm not sure if this is safe way of doing it.
@ProfessorHankStalica6 ай бұрын
Why not just make an array of chars? char nums[size]; nums[0] = 1; 1 is stored in a single byte then.
@TheRawi6 ай бұрын
@@ProfessorHankStalica Because I'm dealing with different types in the array. It's like a low level memory access like assembly stack where you can store 1 , 2 or 4 bytes.
@ProfessorHankStalica6 ай бұрын
Sounds like you need an array of unions possibly: kzbin.info/www/bejne/o3y7d6tsZZWpiJIsi=g5Fa7HqLf74RXLo8 union Foo { char c; short s; int i; }; Foo stuff[10]; That would allow you to store 1, 2, or 4 bytes in each element of you array.
@alimohsin36017 ай бұрын
Loved the explanation. Could you kindly make a video on dynamic casting as well? I'm having a hard time understanding why do we need dynamic casting in the first place. Lets say if their is a virtual function hello() in parent class and we wanna call the overridden hello of derived/child class, wouldn't this approach also achieve the result we want from dynamic cast. Parent * Ptr; Parent P_obj; Child C_obj: Child2 C2_obj; Ptr = &P_obj; Ptr = &C2_obj;
@ProfessorHankStalica7 ай бұрын
In your example, yes because you are using inheritance. It's a form of implicit casting. An example of why you need casting: static_cast(5)/4 to avoid integer division or int a[10]; f.write(reinterpret_cast(a), sizeof(a)) for writing to a binary file.
@visitor_t-w3p10 ай бұрын
I planned to do a the exact clever trick, but then u showed it was a mistake to wrap x/y inside static cast.. Im so stupid :P btw, very straight to the point of demonstration. I liked it
@ProfessorHankStalica10 ай бұрын
Not stupid at all, just didn't know. I have been teaching C++, Python, Java for many years and there's still a ton I don't know. It's normal. Majority of programmers only use a fraction of whatever languages they know. 👍 Glad you got some value out of the video. Thanks for the comment.
@muhammadamin5284 Жыл бұрын
sir why you use cin.ignore() and cin.get() ??
@ProfessorHankStalica Жыл бұрын
Here you go: kzbin.info/www/bejne/hHqqmZ2ojLGKeNE
@lickguitars1276 Жыл бұрын
i just converted float to int for modulating two numbers, pls take a look if its a good practice or not #include int main() { float num1, num2; std::cout > num1; std::cout > num2; std::cout
@ProfessorHankStalica Жыл бұрын
Seems kind of pointless to me to store the input as floats since you convert them to ints anyway. Why not just make them floats in the first place thereby saving memory and the conversion operations?
@maknify45385 ай бұрын
how do you delete the whole word without deleting a certain character in that word?
@ProfessorHankStalica5 ай бұрын
Question is too broad, so the answer is "it depends".