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, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <iostream> struct Node { long data; Node *next; }; Node heap[1000]; int capacity = 1000; int size = 0; Node *alloc() { // For dynamic allocation you would: // return new Node; // For stack allocation you would: // return &heap[++size]; if (size >= capacity) throw std::bad_alloc(); return &heap[size++]; } int main() { Node *head = alloc(); head->data = 999; std::cout << "head: " << head << " (value: " << head->data << ")\n"; Node *new_node = alloc(); new_node->data = 1; head->next = new_node; std::cout << "node: " << new_node << " (value: " << (head->next)->data << ")\n"; std::cout << "heap: " << heap << " (used/capacity: " << size << "/" << capacity << ")\n"; 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