online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <cstdio> template<uint32_t N> class NamedFixedBuffer { static_assert(N > 0, "Buffer must have non-zero size"); public: NamedFixedBuffer(char const *n) : name(n) , size(N) , buffer{ 0xFF } // Init first byte { this->info(); } void info() { std::cout << "name : " << this->name << '\n'; std::cout << "size : " << this->size << '\n'; } void print() { for (uint32_t i = 0; i < this->size; ++i) { printf("0x%02X ", buffer[i]); // ... } } // ... private: std::string name; uint32_t size; uint8_t buffer[N]; // ... }; int main() { constexpr char const *name = "TestBuffer"; constexpr uint32_t size = 16; NamedFixedBuffer<size> nfb(name); nfb.print(); }

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