Anonymous
help me please 🙏
Anonymous
Anonymous
I want every time I write { and then press enter, I get it like this, as in other IDE's
Talula
I am using the Codeblocks IDE
Don't use codeblocks, I use Visual Studio Code.
Ilya
i am starting to like C alot , i feel like its more manageable to learn ,
Plain C is very stupid, limited language to stick to.
Ilya
you got two groups of people , people that C guys and C++ guys that hate on C and say that C style of coding is not good . OOP lovers , and there are some who are not so bias
in you program, you structure Island -- it is not a recursive structure, it is a list. And you'd better segregate list itself as a universal structure from the data it holds, so that when data structure changes, the list would stay same.
Bhaskar
Bhaskar
Can anyone explain this one
Bhaskar
The answer is 16. Shouldn't it be 8
Arun
I'm doing this cpp project that simulates a natural ecosystem. I've got a list that holds the organism objects that are currently active and a couple of arrays that contain environment data, and a bunch of functions from random to make sure that the execution is different each time. I'm getting a bus error or a segmentation fault error when I run my program. I checked the arrays and the list insertion and deletion and I can't find anything off key. Could anyone helping I share the link to the code?
Arun
But this happens only when I crank the number of iterations upto a 100 or more
Bhaskar
2 X 4
Ilya
2 X 4
why ?
Bhaskar
It is saying n-1, that would be 2 * 4
Bhaskar
Yes
Bhaskar
We are passing 5 in the fun argument
Ilya
Yes
No, just compute all the sequence, and you will see yourself
Ilya
We are passing 5 in the fun argument
for 1 we have 1 for 2 we will have 2 * f(1) = 2 for 3 we will have 2 * f(2) = 4 and you can go on...
Ilya
Bennie
And thank god they are dead now
Only in C++17 std, but I suspect a lot of compilers will continue to support them as extensions to support old code
Ilya
I'm using vim on mint right now, so is there a cli method to do this other than valgrind? Cause I cannot figure valgrind out
You do not need valgring here. Run you program under GDB (from GDB) and reproduce the situation, print stack , and find the place in your code.
Arun
Right. Thank you!
Javi
Then for 5, 2*f(4) = 8
Why do you think that 2*f(4) is 8? How much is f(4)?
Anonymous
/warn screen photo
Tom
rust
Anonymous
Hii
klimi
rust
Rules
Anonymous
rust
/warn rules?🧐🤷‍♂
Talula
It’s example of recursion.
Ilya
rust
Ranges can generate stuff much more complex!
Dima
Lol
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
Like?!
Ilya
C++20 ranges?!
They exist even before 20, in Boost
Anonymous
still learning about memory allocation
Ilya
still learning about memory allocation
There is nothing to learn there . wrote malloc - write free
Dima
Or use shared_ptr
Anonymous
Plain C is very stupid, limited language to stick to.
i am learning C because there is a certification i want to get that you need either C or java knowledge to take the test, i figured C, since its close to C++ and something i will eventually get into
Anonymous
there is a free function that frees the memory
Dima
Lol taking language certification in 2019
Anonymous
You'd better learn Java for that...
i already started with C , plus there is another course i am interested in also , that they use C , and C only for a few months before they get into c++
Anonymous
Lol taking language certification in 2019
it allows me to get a certain type of visa to work in certain countries i am interested in living for a bit
Anonymous
get some work experience overseas ,so when i come back i have a decent resume, and can apply for companies in my home country
Anonymous
alos get a chance to travel
Anonymous
otherwise i would need a degree to be able to legally work in these places , which i dont have, nor plan on getting
R
Can someone help for some tips?
Anonymous
Lol taking language certification in 2019
lets not do the trolling so early in the day
Anonymous
and try to accept each other for our goals and differences
Ilya
Can someone help for some tips?
and what is the problem?
R
I just need to create some formula I think but I can not understand how.I googled it but Cant find smth
Dima
lets not do the trolling so early in the day
I am not trolling, this is funny because it’s the old fashioned way anyways if it’s giving you such feature, then it’s very nice
Bohdan
Good day, ladies and gentlemen. I encountered such a problem: I need to get the value from a vector that is stored as a pointer inside an object. I am trying to dereference a pointer, however I am getting an error. The only option that I found was to directly call the [] operator, but it doesn’t look very good Can someone help me please?
Bohdan
There is no mistake. There is only my poor syntax knowledge in C \ C ++. I want to do something like this but it leads to an error
Bohdan
Oh so that's how it works. thank you very much!!) it helps )
Flyingblu
Hi guys, is there any data structure that can perform quick search but with low memory usage?
Flyingblu
set and map are quick but their memory usage are too high, probably because they are linked lists.
Flyingblu
Anybody there? 😅
Sergey
Anybody there? 😅
Sorted vector and binary search :)
Flyingblu
Sorted vector and binary search :)
So I need to use std::sort & std::find on vectors?
Flyingblu
Well std::binary_search