// helloworld.cpp
#include 

using namespace std;

int main()
{
    cout<<"Hello World";

    return 0;
}

About This C and C++ Editor

C and C++ are the languages the rest of the stack is built on: kernels, browsers, databases, game engines and the runtimes of most other languages. They give you direct control over memory, which is exactly why they are fast and exactly why they are dangerous.

The editor highlights preprocessor directives, templates, pointers and raw string literals, and matches braces across long files.

Modern C++ worth using

C and C++ syntax reference
Syntax What it does
auto x = compute(); Type inference. The variable is still statically typed.
std::unique_ptr<T> p = std::make_unique<T>(); Sole ownership, freed automatically. Replaces most raw new/delete.
std::shared_ptr<T> Reference-counted ownership. Watch for cycles; break them with weak_ptr.
for (const auto& item : container) Range-based for. The reference avoids a copy.
constexpr int square(int n) { return n * n; } Evaluated at compile time where possible.
auto f = [&](int x) { return x + y; }; Lambda. [&amp;] captures by reference, [=] by value - choose deliberately.
std::optional<int> parse(std::string_view s); Expresses "may not return a value" without a sentinel.
#include <memory> C++ headers have no .h; C headers become &lt;cstdio&gt; and friends.

Undefined behaviour and how to avoid it

  • Reading past the end of an array is undefined, not an error. The program may work, crash, or corrupt data silently. Use std::vector and .at() while debugging.
  • Dangling references. Returning a reference or pointer to a local is undefined behaviour that often appears to work in debug builds.
  • The Rule of Zero. If your class needs a destructor, copy constructor or copy assignment, it probably needs all of them - and it probably should not need any, because a smart pointer or container should own the resource.
  • Uninitialised variables hold whatever was in that memory. Always initialise at declaration.
  • Integer overflow on signed types is undefined, and optimisers exploit that assumption in ways that surprise people.

Your Code Never Leaves Your Browser

The editor is JavaScript running in this tab. Nothing you type is posted to a server, stored, logged or associated with you, and there is no account and no autosave. That makes it safe to paste a snippet from a private codebase in order to read it with highlighting. The trade-off is that nothing persists either — refresh the page and your content is gone, so copy anything you want to keep.

Frequently Asked Questions

Can I compile C or C++ here?

No. Compiling needs a toolchain, and none is attached - this is an editor for reading and formatting code. Nothing you type is executed or uploaded.

What is the difference between C and C++?

C is a small procedural language with manual memory management. C++ adds classes, templates, exceptions, RAII and a large standard library. Most C is valid C++, but idiomatic modern C++ looks nothing like C.

Should I still use new and delete?

Rarely. Prefer std::unique_ptr and std::shared_ptr, or a container that owns its storage. Manual new/delete is the source of most leaks and double-frees in real codebases.

Editors for Other Languages

Same editor, configured for a different language, each with its own syntax reference.