online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdio.h> typedef struct node { int val; struct node *next; } node_t; void pushOnTheEnd(node_t *head, int value) { node_t *current = head; while (current->next != NULL) { current = current->next; } /* now we can add a new variable */ current->next = malloc(sizeof(node_t)); current->next->val = value; current->next->next = NULL; } int numberOfEvenElements(node_t *node) { if (node == NULL) { return 0; } else return (node->val != 0 && node->val % 2 == 0) ? 1 + numberOfEvenElements(node->next) : numberOfEvenElements(node->next) ; } int main() { node_t *head = malloc(sizeof(node_t)); head->val = 2; pushOnTheEnd(head, 4); pushOnTheEnd(head, 6); // head->next = malloc(sizeof(node_t)); // head->next->val = 4; // head->next->next = malloc(sizeof(node_t)); // head->next->next->val = 6; printf("even count = %d", numberOfEvenElements(head)); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue