Anonymous
J
dude, to a paste bin, not a description
Anonymous
Anonymous
and this is the output
Anonymous
J
#pastebin
Anonymous
https://pastebin.com/uxyWhQwy this is the first time i post a code in Pastebin. sorry about that. i forgot it :)
olli
https://pastebin.com/uxyWhQwy this is the first time i post a code in Pastebin. sorry about that. i forgot it :)
+ / \ / \ * 2 / \ / \ 3 4 if you want to have this tree you should also create five tree nodes instead of three, e.g. struct TREE *N2 = make_node(integer, NULL, NULL, "2"); struct TREE *N3 = make_node(integer, NULL, NULL, "3"); struct TREE *N4 = make_node(integer, NULL, NULL, "4"); struct TREE *NMul = make_node(multi, N3, N4, "*"); struct TREE *NPlus = make_node(plus, NMul, N2, "+"); I don't know how you expect the output to look like, but by printing the value of n instead of its operation you can get something like this (null) 3 (null) (null) 4 (null) 3 * 4 (null) 2 (null) * + 2 Make sure to initialize the local variables, otherwise you'll likely end up printing garbage for the leave nodes char *left_value = NULL; char *right_value = NULL; https://godbolt.org/z/Y7x8zz
Sherlock
Can someone help me
Sherlock
my code runs on other platforms successfully but on hackerrank it fails to compile
Sherlock
free(): invalid next size (fast) Reading symbols from Solution...done. [New LWP 341797] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `./Solution'. Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
Indolent
https://hastebin.com/ibekoyejuj.cpp
Indolent
This code gives segmentation fault. Anyone has any idea why?
Indolent
Have you tried to use debugger?
I did. Couldn't really figure out anything from it.
Indolent
I think I found something.
Indolent
Yeah that was it. I knew it was something very silly. Like always.
Pablo humano
How can i clean the input un a socket?
Alex
even if you clean socket new data will arrive during cleaning
Alex
what are you trying to achieve?
Pablo humano
what are you trying to achieve?
I am doing a server, but the problem is when i receive a message, part of the message part stays in the socket, and when I receive other messages It show me things like a chat.zip�����
Mohit ^_^
I want to execute some instructions but only on the first recursive call. Therefore I used the static keyword. But the problem is there are multiple testcases(gfg) and when the function is called again, static variable execution is ignored & I cannot modify the main(). So my result is being merged with the previous result. How can I solve it ?
Pablo humano
Alex
you should use application layer protocol and read data until end of the protocol message is found
Sherlock
I need help in dynamic array in c code
Alex
TCP does not preserve message boundaries
Pablo humano
TCP does not preserve message boundaries
thank you very much for your help
Alex
you are welcome
Mohit ^_^
do not use static, use function argument
bro I'd have, if I could but editing in the main function is locked
Mohit ^_^
Do you have some trash in socket after job is done? Or looking for way to compile whole message from pieces (segmentation)?
let me show you. Node* bTreeToCList(Node* root) { // I want to set these two objs. below as NULL on the first recursive call, but do it on every new function call static Node* CDLL = NULL; static Node* Rt = NULL; //end if (root) { bTreeToCList(root->left); if (!CDLL) { auto tmp = newNode(root->data); CDLL = tmp; CDLL->left = CDLL->right = CDLL; Rt = CDLL; } else { auto tmp = newNode(root->data); CDLL->right = tmp; CDLL->right->left = CDLL; CDLL = CDLL->right; Rt->left = CDLL; CDLL->right = Rt; } bTreeToCList(root->right); } return Rt; }
Joan
https://youtu.be/srpn69L4NCQ
Anonymous
I read all rule but may be it will against of your rule Because I am not a programmer But I want help to add a tool on a software
Anonymous
Please can anyone help me
Anonymous
Here
Anonymous
I'm working on a program in which some chapters like a book are there with five set of question(mcq) in each. Is there anyone ever done such type of program ?
Mohit ^_^
It was for humano.h sorry )))
np. I solved it by creating a dummy function
Adarsh
can anyone tell me error in the copy constructor of the main()
da
can anyone tell me error in the copy constructor of the main()
Rectangle b{Rectangle()}; cout<<b.area()<<endl<<b.perimeter()<<endl;
Sherlock
I need help in dynamic array in c code
I have seen that every solution online is using extra variable to contain the same variable which is in the array for example https://github.com/hackerearthclub/CODE2RACE/blob/master/OPEN%20CHALLENGE/dynamicArray.c Here book variable doesn't needs to be created as the value is present in the array but the progrm doesn't runs without doing it
Sherlock
That has nothing to do with me it's someone else's solution
V01D
That has nothing to do with me it's someone else's solution
Is hacktoberfest a hacking challenge or coding challenge
Sherlock
Too lazy
Help with the solution if you can plz
su
I need help in dynamic array in c code
https://github.com/funcelot/c
V01D
#shameless-plug
su
??
what? do you need help with dynamic arrays in C? this is a C code, any questions?
Sherlock
say whaaat
V01D
😂
V01D
say whaaat
Best reaction to a warn ever, thanks for that
Ayomide peter
Hi guys evening
Sherlock
I think my code's never gonna complete
zelika
mine too
🇷​🇮​🇸​🇭​🇺
Hello
Punisher
int main() { int t=3; while(t--) { int sum; sum+=1; cout<<sum<<"\n"; } return 0; }
Punisher
why its output is 1 2 3
Punisher
when it should be 1 1 1
Evgeny@FT
Because you should initialize you variables. Using uninitialized variables is UB
V01D
int main() { int t=3; int sum = 1; while(t--) { cout<<sum<<'\n'; } return 0; } Punisher
Anonymous
I have seen a lot of posts regarding one pass and multi pass compilers and I think the basic parts of a One Pass Compiler as follows. > 1. Lexical Analysis > 2. Parse and Syntax Check > 3. Symbol Table > 4. Code Generation But I have a question, that I cannot understand. How does Expression work in one pass compiler ( Without AST ) Let's take 1 + 2 / 3 as an example. Suppose you need to generate assembly code for this. After create a parser, how does generate assembly from it? ( Directly ) How does assembly code generate without any errors? Can you explain this? :)
Timo
Is the Shunting-yard algorithm maybe what you are looking for?
Anunay
/warn promo
Ninja
So?
Anunay
Read rules