Dima
lol
Anonymous
hello guys!
Anonymous
could somebody help with the code to program a kind of 'battleship game' ?
Anonymous
in language c
Anonymous
anyone has the battleship code?
Caio
How so?
Caio
An battleship game?
Anonymous
anyone has the battleship code?
we've helped you in other group
Anonymous
we even gave you source code
Anonymous
start thinking instead of asking xD
Anonymous
and that source code has a lot of comments, so just read it
Anonymous
sry vms, i was trying to take the more resources as possible :(
Anonymous
the more the better
Anonymous
the more the better
google "battleship game in c"
Anonymous
hahahha not everyone has it
Anonymous
has what? google?
Anonymous
battleship game man
Anonymous
even in google there are not so much good codes
Anonymous
yeah but
Anonymous
i mean good ones u know
Caio
Someone knows an library kind of “vector” one, but better than it?
Anonymous
i mean good ones u know
how can you determine if it's good or not without even looking at the code? xD
Anonymous
Anonymous
i ain´t saying that they´re bad, but there are with other different structures that i dont feel so much comfortable, bc i haven´t used them before.
Anonymous
you're loosing time
Anonymous
🤨
start doing what they told you in the other group
Anonymous
make the two arrays and start from there
Anonymous
display the board, make a function to check the coords of a board, etc
Anonymous
alright
Igor🇺🇦
Someone knows an library kind of “vector” one, but better than it?
"kind of vector one"??? Do you mean std library?
Anonymous
I use the same namespace in separate cpp files(not separatint the namespace definition), then I got multiple definition of ..., why?
Anonymous
The circumstances is similar to http://www.cplusplus.com/forum/beginner/12458/
Mat
The circumstances is similar to http://www.cplusplus.com/forum/beginner/12458/
In this link seems like he's defining the i two times
Pavel
The circumstances is similar to http://www.cplusplus.com/forum/beginner/12458/
namespace nn { int i = 5; }; Here's the error, this violates ODR
Pavel
This should be divided into header and cpp Header with extern, cpp with nn::i = 5;
Pavel
Or using inline if it's C++17
Anonymous
What if namepace nn{int i;}; is it correct?
Anonymous
Or just describ how to use the same namepace in multiple cpp file is ok
Pavel
What if namepace nn{int i;}; is it correct?
AFAIK, it is still definition, so no. namespace { extern int i; }
Anonymous
Ok, thanks
Pavel
Or just describ how to use the same namepace in multiple cpp file is ok
By the way, namespaces have nothing to do with the error. Without namespaces it would be the same.
Anonymous
Yep, I think the ordinary method is to use extern to declare a external variable, instead of namespace, which might often used for funtion name.
Anonymous
I just confused if it's used for definition while there are multiple files.
Pavel
I just confused if it's used for definition while there are multiple files.
There's a rule of thumb: It you need a global variable that available in a header, use extern. And define it in cpp. If you need such a variable only for one cpp, use static.
Anonymous
I know how to use static and extern, though. Anyway, thanks for the advices.
Ashur
Hello
Ashur
Okay🙃
klimi
ex4_mp1e
Hi
klimi
Hi
Hi?
ex4_mp1e
Hi?
How about your programming knowledge..?
klimi
What do you mean
francis
hello. what is function recursion?
Muamall
hey guys i want web site or a book just for c examples
klimi
hello. what is function recursion?
When you can the function within the function
Artöm
Ass we can
Dima
what do you need
Dima
what?
Dima
learn language basics
🐉
https://hastebin.com/penuxoguke.css What does happen to that things(0) ?
Artöm
Zero init
Igor🇺🇦
https://hastebin.com/penuxoguke.css What does happen to that things(0) ?
Use nullptr instead of 0. That makes code clearer.
🐉
Use nullptr instead of 0. That makes code clearer.
basically the *things will point to nothing, correct?
Ludovic 'Archivist'
It looks like homework to me
Ludovic 'Archivist'
basically the *things will point to nothing, correct?
It is most of the time the same as 0. nullptr is an alias for an invalid pointer. Most systems use 0 as it is cheap to compare against 0. It is in theory possible to have other values for nullptr, another possible value is std::numeric_limits<intptr_t>::max()
Ludovic 'Archivist'
In C++, using nullptr is always preferred as it is more readable
Ludovic 'Archivist'
In C, it is advised to use the macro NULL
🐉
More like I hope there are no problems when doing something like Bar *array = new Bar [10];
🐉
Because in this case the default constructor would be called, am I correct?