Anonymous
http://coliru.stacked-crooked.com/a/28b3745bad221df4
olli
Exactly, so be careful when to use reinterpret_cast
Anonymous
why does it segv when i use reinterpret_cast but not static_cast nor dynamic_cast?
olli
It has to do with how non trivial types are layed out in memory. In this case the sub object of type B2 in D does not start at the same address. Clang gives really nice warnings about this. By reinterpret casting you tell the compiler that you are aware of how the memory is layed out and whatever is there should be treated as if it would be part of another type. Using a static_cast you let the compiler verify that the two types are in fact related and let the compiler do the necessary computations.
Anonymous
hmm ok
Anonymous
can dynamic_cast do everything that reinterpret_cast does?
olli
can dynamic_cast do everything that reinterpret_cast does?
No. There is no "silver bullet" that does everything you want. I would only use dynamic_cast when it's really necessary since it's behavior is not trivial and has runtime impact. The idea behind reinterpret_cast and dynamic_cast are different.
Anonymous
ok
Igor🇺🇦
can dynamic_cast do everything that reinterpret_cast does?
Here is a good link explaining differences between different kinds of casts in C++ - https://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-const-cast-and-reinterpret-cast-be-used
ברני
Hey guys...Im feeling im not learning right.. (learning C alone) Can someone please advice me from where should I learn it the best? (I rather video courses then books of posiblle✌️) I would like to hear if someone here learned it alone and from where..
ברני
i learned it alone :)
From books? Where are you on c?
Anonymous
and il still learning XD
Anonymous
tho tbh noone learns it completely
Anonymous
sooner or later you will forget something and will need to relearn :)
Anonymous
From books? Where are you on c?
i learned it by programming :)
ברני
I would suggest you solving some Dcoder questions...
That's what I'm doing (a friend sent me his tasks from his academy) and I get stuck every question.. Just got to char 2d array, on the same question for 2 days now 😔
Ralph
For the basic basic
Anonymous
eg if you want to print something there is no reason to learn multi dimentional arrays and stuff
Roshan
Hey, I sponsored an android app
There are 197 questions. You'll learn solving questions and be in pace...
ברני
I suppose
Will check it (used to learn math from there) Ty all check all the sites you sent
Roshan
Will check it (used to learn math from there) Ty all check all the sites you sent
Hey can I give you a playlist is youtube - my favourite for c++?
Ralph
I landed on the comment sections
Ralph
https://www.khanacademy.org/computing/computer-programming
Roshan
I'm learning C
Oh ok it was C++ by Cherno!
Roshan
Anyone else interested in learning C++ from youtube? I'll provide the playlist...
Igor🇺🇦
Page on 404 error
Just try links here https://www.cprogramming.com It gives tutorial with simple tasks with increased complexity
Roshan
Hey all, I was learning OOP and I've a question... Is it really necessary to use OOP when we can use functions for the same?
Xudoyberdi
I'm learning C
Work on projects From hello world projects to bank management system
Xudoyberdi
I'm learning C
And if you want videos Caleb Curry, Mike Dane, cs50 from YouTube
Xudoyberdi
Neso Academy
Uuuu that should be great too, they have playlist👍
RC
Can anyone help me with algorithm?
Anonymous
The problem i have with youtube tutorials is that they just explain the topic and they don't show the use case of that topic
ברני
here's the last code I made.. the task was to put the biggest chars in the third array... https://onlinegdb.com/3abIprWLr I don't know what should I learn to understand how to do it with no problams...
Anonymous
Maybe you'll like Cherno (YouTube) for C++. He explains cases too...
Yh he is really good especially if u want to be a game dev huh he teaches cpp instead c
olli
here's the last code I made.. the task was to put the biggest chars in the third array... https://onlinegdb.com/3abIprWLr I don't know what should I learn to understand how to do it with no problams...
> I don't know what should I learn to understand how to do it with no problems... The basics, before dealing with arrays you should be comfortable to - conditionals, including if/else and loops - call, declare and define functions and understand parameters E.g. - in your main, print every factorial number from 1 to n (read n from the user) - in your main, print the fibonacci series up to a certain number n (read n from the user) - write a function int isPrime(int) that checks whether a number is prime. Use it in main to print all prime numbers up to a certain number n (read n from the user) - write a program that reads a number and perfoms a 'prime factorization' We used tasks like these for our freshmen at Uni, lmk if you want more... If you're not comfortable dealing with these tasks I would refrain from dealing with arrays
amninder
/get cppbookguide
Pavel
You know why this request is bad? And why people don't answer to messages like that? dontasktoask.com
ברני
Depends , do you want to make projects etc ?
I want to learn C perfect so I could move on to C# and JS, HTML & Java
Lava
I would move on to c++ right away unless c is in your college course or something.
ברני
I want to learn how to code programs, games, website and etc so I could also enjoy a nice Hobbie (I want to create my own stuff) And also have enough knowledge to work on the indestry..
ברני
I would move on to c++ right away unless c is in your college course or something.
I will touch c++ a little but I learning C mainly because it's the basic of the basics..
Lava
In general the basics would be loops , arrays ,strings, structures, functions , classes in c++ , sorting and other algorithms , then data structures .
Lava
Then try to make simple games right now like cross and nuts , maybe chess etc . Later you could even learn graphics and also learn how to use unity to make games . Unity uses c/ c++
ברני
In general the basics would be loops , arrays ,strings, structures, functions , classes in c++ , sorting and other algorithms , then data structures .
My problem is that I did learn the basics tools.. for, while, if, else, switch and more, but I'm struggle logecly must of the time
Anonymous
Practice makes perfect
Lava
Practice more then . Maybe the easy level questions on hacker rank and other competitive coding websites .
Lava
Try those pattern questions if you want to get better on for loops etc
Lava
Array / subarray later .
ברני
Practice makes perfect
I went to basic level tasks and it was kinda easy..
ברני
I'll try to go above.. Ty guys :)
Lava
I'll try to go above.. Ty guys :)
You can see freecodecamps 4 hr video on basics on C . It should help and will get you a bit further from where you are right now :)
olli
Is there any recommend place that you'll suggest for me? (asking because you know my level)
practice, a lot of practice! you don't really learn to code by watching videos. Again, I'd recommend to try one of the simple tasks I mentioned earlier. If you know loops that should be fairly straightfoward.
Makgato
Guys it is possible to convert C++ program to Android