Stefan
Sorry i don't know about k&r c
as i said it is the very very old & ancient version of c that is being forgotten but i think we should remember its significance
Stefan
C does not require prototype of function is called. You get compilation warning
it just push the arguments to call stack and then call the function anyway
Anonymous
in fact that is why when writing function declarations that take no arguments, you should write (void) instead of ()
Anonymous
because () will let the function execute with any arguments
Som
Can we post meme here?
Dima
depends, better to
Dima
#ot
Samuele
while (isOn == true); { std::cout << "1" << std::endl; isOn = false; for (int i=0; i<num; i++) { if (s[i].x==a.x && s[i].y==a.y) { mela(); std::cout << "2" << std::endl; isOn = true; } } } Hi, when the program arrives at mela(), it freezes. Anyone know what the problem might be?
Samuele
void mela() { a.x=rand()%dim; a.y=rand()%dim; }
Samuele
a is a struct
𝐀𝐡𝐦𝐞𝐝 𝐄𝐡𝐚𝐛
hi
Alex
good luck. I am sure you will succeed
Dima
read the rules
MᏫᎻᎯᎷᎷᎬᎠ
.
m21p99
Can anyone help me with this function. int * compact (int * s1, int dim): receives an S1 vector filled with dim elements, and creates another allocated one dynamically so that identical consecutive elements are replaced by a single occurrence. The function it must return the pointer to a new dynamically allocated integer vector. For example, if S1 = {1,2,2,4,4,4,5,6,7,7}, the function creates a new vector S2 = {1,2,4,5,6,7} composed of 6 elements.
Marián
are any of you guys into competitive programming?
Anunay
Organized two events in the past year
Marián
lol cool
Marián
i wanted to ask, what is any good resource to start?
Marián
i found myself being very but very bad in competitive progamming, like i can't do anything under pressure if it involves hardcore logical thinking and i want to improve it
Marián
codeforces
Anunay
i know only about codeforfces
There's also hackerrank
Anunay
i wanted to ask, what is any good resource to start?
Practice data structures and some commonly used algos
Marián
i know lot about datastructs but i am so back at algorithms, especially mathematical based
Marián
i know lot about CGI so i am into hardcore maths like calculus, linear algebra and stuff but when u ask me to do algorithm that finds some common prime factors blahl blah blah i am totally lost ngl
Marián
is something like geeks4geeks good place?
Marián
hmmhhh okay
Marián
There's also hackerrank
will check this as well, thanks
Anunay
will check this as well, thanks
if you want to try something out, hackerrank.com/codex-december hackerank.com/battle-of-vars-2020
Anunay
These are the ones I organized
Marián
looks cool
Alion🦁
Hi guys. Why this code doesn't work std::cout.print("hi").print(std::endl); I am watching a playlist, that guy wrote and it works, but in my side it doesn't
☬ੴ Bassi
std::cout « "hi" « std::endl;
Marián
hmm interesting point of view
Marián
i always thought it's more about algorithms
Alion🦁
std::cout « "hi" « std::endl;
It is clear. But, why this doesn't work? where, he wrote and it was fine
Marián
yeah i just don't have time to anwer, i am in bus, will answer more in few hours, sry and thanks
Alion🦁
Yeah, I was a bit surprised when I saw it too, but what can we do.
☬ੴ Bassi
#include<iostream> int main() { std::cout « "hi" « std::endl; return 0; }
☬ੴ Bassi
maybe the guy made a print function prior
☬ੴ Bassi
thats why he is wrapping it in ()
Alion🦁
yes, from where did he "created" it IDK 😅
Anonymous
yes, from where did he "created" it IDK 😅
no you can write std::cout.operator<<("hi").operator<<(std::endl);
Anonymous
i think he wanted to write to cout with that
☬ੴ Bassi
std::cout << print("hi") << print(std::endl);
☬ੴ Bassi
this might be possible
☬ੴ Bassi
maybe the guy is writting in another langauge like cython or something
☬ੴ Bassi
i have not seen cython code before
Alion🦁
let me, send the video's link itself.
☬ੴ Bassi
ty
Alion🦁
☬ੴ Bassi
please send link
Alion🦁
https://youtu.be/SfGuIVzE_Os?list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb 3:10 of the video
Alion🦁
please send link
here you are 🤗thanks for trying help
☬ੴ Bassi
please send me seconds
Anonymous
std::cout << print("hi") << print(std::endl);
template <class... Args> constexpr decltype(auto) print(Args &&... args) { return std::forward<Args>(args)...; } ? idk much about pack expansion, please don't kill me ;-;
Alion🦁
please send me seconds
yeah, I wrote 3:10
☬ੴ Bassi
sorry ty
☬ੴ Bassi
dude in the video he is telling you what this is doing
Anonymous
yeah, I wrote 3:10
"though you need to think of them as function"
Alion🦁
Even, I think, I will go and contact with him
Anonymous
he is explaining it assuming you have done some other language where there is no operator overloading
☬ੴ Bassi
at 3:25 he removes the text
☬ੴ Bassi
he is saying in other languages what we would do is this do this...
Anonymous
wew parameter pack joined
Alion🦁
🙈oh, really? sorry, for that. 🤦‍♂️I misunderstood him @chandradeepdey and @Oneinit sorry, dudes 🙏