Anonymous
The challenge seems weird
Anonymous
Selfmodifying Code +==============+ Language: C, C++ Time: 20 minutes +==============+ Make a function that changes its own code! +==============+ Solutions and challenge ideas to @maxi_robot
Anonymous
challenge I got
Anonymous
Language:c, c++
Artöm
In a group I found a programming challenge to write a self modifying function..
My guess is void f() { // shit ((char*)f)[dunno] = some_num; }
Artöm
But you need to know assembly
Artöm
And understand exactly how codegen works
Anonymous
My guess is void f() { // shit ((char*)f)[dunno] = some_num; }
I am unable to understand can u explain what have you written actually I am new to programming
Anonymous
And stop doing these challenges
Anonymous
My guess is void f() { // shit ((char*)f)[dunno] = some_num; }
It's total UB that will cause segmentation fault, i think
Artöm
It's total UB that will cause segmentation fault, i think
It defenitely is, no segfault with enough care
Anonymous
Can you people suggest me a group where I will get good programming challenges?
Anonymous
HackerRank
Anonymous
Ok thanks definitely I will work there
Khan
#include <stdio.h> int main(){ for (int angka = 0;angka < 501; angka++){ printf("Angake Ke %d\n,",angka); } } why the for is error?
Dima
What the hell
Khan
There is no error here
so why i can't run thr program?
Anonymous
Khan
'for'loop initial declaration are only allowed in C99 mode
Khan
what that's mean?
yoav
the news only difference between c and cpp is that cpp is OOP?
Anonymous
the news only difference between c and cpp is that cpp is OOP?
C++ is more type-safe It has templates and metaprogramming
Ilya
the news only difference between c and cpp is that cpp is OOP?
No, there are many many differences, lots of.
Anonymous
It has a lot of features that C does not have and never will
Ilya
'for'loop initial declaration are only allowed in C99 mode
Use C++ compiler or switch C compiler to later ANSI standard mode (I don't know how)
Anonymous
Khan
i still can't run it
yoav
Google it
what is against bugs and security flaws?
Ilya
what is type safe
In two words , C++ is stricter language than plain C / Checks more problems at compile time.
.json
Hello
Khan
i can't run it on C compailer but i can run it on C++,if i want to run it on C compailer waht should i do?
Khan
-std=c99 flag
where i have to put it?
Artöm
where i have to put it?
Where you call compiler
Artöm
How do you compile?
Khan
i can run it right now
Khan
thanks guys
Anonymous
I have 😁
eren
Hii
Olanrewaju O.
hy
I_Interface
hy
nohello.com
Anonymous
Well hello
Anonymous
Can anyone help me with my code
Anonymous
https://pastebin.com/NbE4hGJ2?fbclid=IwAR1udSuZY6z9Ztr22SgpYCnUPmAXkTVmbBZQhgs6BJUSND31IxRvzGSGXVI This is codejam qualification round code
Anonymous
Output is the same they're demanding
Anonymous
Waiting for step 5 to be executed
Anonymous
Any $x developer?
Sachin
//program to check graph is bipartite or not #include<bits/stdc++.h> using namespace std; class Graph{ int v; list<int> *l; public: Graph(int V){ v=V; l=new list<int>[v]; } void addEdge(int v,int u,bool bidir=true){ l[v].push_back(u); if(bidir) l[u].push_back(v); } bool isBipartite(int src){ queue<int> q; q.push(src); int *color=new int[v]; for(auto i=0;i<v;i++){ color[i]=-1; } color[src]=0; bool ans=true; while(!q.empty()&&ans){ int u=q.front(); q.pop(); for(auto v:l[u]){ if(color[v]=-1){ color[v]=1-color[u]; q.push(v); } else if(color[v]==color[u]){ return false; break; }} } return true; }}; int main(){ Graph g(4); g.addEdge(0,1); g.addEdge(2,0); g.addEdge(1,3);g.addEdge(2,3); // g.addEdge(1,2); if(g.isBipartite(0)){ cout<<"yes"; } else{ cout<<"no"; } return 0; }
I_Interface
Read the rules
Blamed ppl, pasted howtoask, meta for them...
Sachin
Read the rules
Did I break the rules?
Anonymous
Did I break the rules?
Haahh looks like u had to post a pastebin than posting actual code smh
Anonymous
Check if a number is perfect square. Is this the right way? Or I'm thinking of using Binary search. long long p = sqrtl(K); if(p*p==K){ cout<<"YES"; } else{ cout<<"NO"; }
Anonymous
Is the above one the safest and the most correct way to do that?
Anonymous
So what's the issue?
Sites not acceptin my code
Dima
Did I break the rules?
Format your code at least
olli
Sites not acceptin my code
So it's probably not what they demand? What's the question? And what's the output of the judge? Is it actually that hard to ask a question that can be answered?!
Anonymous
Imma post the que right here
Anonymous
https://codingcompetitions.withgoogle.com/codejam/round/0000000000051705/0000000000088231 Heres the question
Muhammad
Guys How many languages Computer science includes?
Muhammad
ex.C programming
Muhammad
and how about other languages