Content
@
0 reply
0 recast
0 reaction
Anton
@antohin
🔥 Let's talk about mistakes! 🔥 Check the code below and give your answer! *** C-CODE *** #include <stdio.h> #include <stdlib.h> typedef struct block_chain_link{ float send; float receive; struct block_chain_link* next_link; } block_chain_link; int main() { block_chain_link* new_link; block_chain_link* ptr = NULL; float amount = 5.321652; // first block new_link = (block_chain_link*)malloc(sizeof(block_chain_link)); new_link->send = amount; new_link->receive = 0; new_link->next_link = ptr; ptr = new_link; // second block new_link = (block_chain_link*)malloc(sizeof(block_chain_link)); new_link->send = 0; new_link->receive = amount-1; new_link->next_link = ptr; ptr = new_link; printf("Block 2: receiver received of %f token amount\n", ptr->receive); ptr = ptr->next_link; printf("Block 1: sender sent of %f token amount", ptr->send); return 0; }
0 reply
1 recast
3 reactions