Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Default copy
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <iostream> using namespace std; class Foo{ public: int bar, *baz; Foo(int x): bar(x){ baz = new int; *baz = 2; } }; int main(){ Foo x(5); Foo y(6); y = x; //bar and baz copied cout << "Before baz edit:" << endl; cout << x.bar << ' ' << y.bar << endl; cout << *x.baz << ' ' << *y.baz << endl; *x.baz = 0; //only x was changed cout << "After edit:" << endl; cout << x.bar << ' ' << y.bar << endl; cout << *x.baz << ' ' << *y.baz << endl; }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.56 sec, absolute running time: 0.21 sec, cpu time: 0.15 sec, memory peak: 3 Mb, absolute service time: 0,79 sec
edit mode
|
history
|
discussion