Anonymous
So can anyone tell
Anonymous
What exactly are classes and objects
Anonymous
Are objects basically variables
Anonymous
And classes are collections of these variables
Anonymous
Which are only defined in certain classes
Anonymous
Umm
Anonymous
Please?
Anonymous
Renan
@rusty Are you familiar with the Rust programming language? 🤔
Renan
What exactly are classes and objects
Consider reading Introduction to Object-Oriented Programming. I am learning too. 🙂
Anonymous
I'm just rusty.
Anmol
Please?
Google it?
Anonymous
Google it?
I did it was mostly explained traditionally like in them documentations hence couldn't understand...
Anonymous
Well nvm
Anonymous
whats the difference between struct Node* head = malloc(sizeof(struct Node)); and struct Node* head =(struct Node*)malloc(sizeof(struct Node));; I'm currently learning Linked list using Data structures in C...
J
one casts the return value to a different type before assignment and the other doesn't.
Vlad
Where malloc returned char* and not void*
Vlad
So you had to cast for your code to compile
Mohit ^_^
good evening. can please take a look here and see what am I doing wrong typedef map<char, int> edges; typedef vector<edges> trie; trie t; t.push_back(edges('a' ,5)); //error at this line(the character part), its some type mismatch but i cannot figure out why
J
paste the compiler output
Vlad
lmao vector of maps
Mohit ^_^
paste the compiler output
E0289 no instance of constructor "std::map<_Kty, _Ty, _Pr, _Alloc>::map [with _Kty=char, _Ty=int, _Pr=std::less<char>, _Alloc=std::allocator<std::pair<const char, int>>]" matches the argument list
Jesvi
/rules
Anonymous
can someone suggest me some resouces/youtube videos i have some exams on c++, so can someone provide good resources
Anonymous
i like to know from the basics
Anonymous
have learned basics of C while ago
Anonymous
Jesvi
Best resource
Anonymous
Www.google.com
google doesnt always provide the best practise/resource
Merazi
you should try searx. It uses several search engines (like duckduckgo, google, bing, qwant, etc) to do its searches
Anonymous
I don't understand why they put return 0 in C, cuz I ran a program without that return statement and it completely worked fine...can anyone tell why they put that??
Merazi
It is a good practice to do it
Anonymous
I've seen some terminals of IDEs show this specific statement after the end " the terminal code terminated with exit code 0" but some doesn't show anything, does this related in anyway..?
Bh@iR@m
From where should I start learning c++ I am begainer
Anonymous
My personal opinion though
Anonymous
Kick
J
get banned
Ajay
Nooo
Anonymous
Nooo
U have read the rules and agreed, one of those rules say that no one is allowed to advertise, if done, will result in a ban...
Ajay
I just read
Anonymous
I just read
The bot literally asks everyone to read the rules and agree to the them before joining...
Ajay
Ok no more share here after.
Aaron Nevalinz
Which is better: C or C++? 🤔
That's like asking whether a bottle is half filled or have Half empty.. Both are good, depends on use!
Renan
That's like asking whether a bottle is half filled or have Half empty.. Both are good, depends on use!
Right tool for the job. One of the advantages of knowing multiple languages. 🙂 And if all else fails... code it in assembly. 👍
Renan
Ok no more share here after.
If the bot could verify the user has indeed read the rules it would be better. One possible solution to this would be to make a few questions about the rules, if the user had at least most of them right then they have likely read the rules and are able to join. 🤔
Anmol
whats the difference between struct Node* head = malloc(sizeof(struct Node)); and struct Node* head =(struct Node*)malloc(sizeof(struct Node));; I'm currently learning Linked list using Data structures in C...
malloc returns a void* and afaik, c++ errors out if assign a void* to a specific type so you need to explicitly cast malloc return type to desired type
Anmol
I'm doing it in C btw , I got the same desired output when I used two of these codes...
C doesn't give error but you can get various problems of you don't cast i think
Anmol
There's a great talk in this years cppcon regarding this so watch that
Anonymous
Anmol
This is more oriented towards c++ but i think for general memory and pointer stuff, it should be enough
Anonymous
Ok
Elnee
Sorry if I'll be a little bit offtopic. I can't find how to show all warnings and errors in CLion. Official documentation says that widget is located at the top right corner and looks as several icons (error, warning, typo) with counter placed right of each icon. https://www.jetbrains.com/help/clion/running-inspections.html#analysis-current-file But I don't have such widget, only one icon that shows most critical result of inpections (error or warning or typo). Does it have separate window with all information about warnings and errors project wide like in Visual Studio?
Elnee
Do u have the latest version?
CLion 2020.1 April 9
Elnee
Oh, now I see. It was documentation of newest version but I have a previous one. Damn, thank you for pointing out.
Mohit ^_^
What C++ standard you use?
VS uses C++14 as default I guess?
Mohit ^_^
Perhaps you typedefed edges but didn't create an object like u did with trie?
Yeah. I opened my notebook an hour later and realized I've been been treating the container like an object. Thanks for the help
Anonymous
VS uses C++14 as default I guess?
Then t.push_back({{'a' ,5}});
Death Killer
when you access any string using index it treats it as char and might cause error for such res.append(s[i]); instructions. What is good way of converting char to string
Alex
you can use string::at if you want index range check