Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sdfsdfs
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
using System; public struct Point { public Point(byte tag, double x, double y) => (Tag, X, Y) = (tag, x, y); public byte Tag { get; } public double X { get; } public double Y { get; } } public class SizeOfOperator { public static void Main() { Console.WriteLine(sizeof(byte)); // output: 1 Console.WriteLine(sizeof(double)); // output: 8 DisplaySizeOf<Point>(); // output: Size of Point is 24 DisplaySizeOf<decimal>(); // output: Size of System.Decimal is 16 unsafe { Console.WriteLine(sizeof(Point*)); // output: 8 } } static unsafe void DisplaySizeOf<T>() where T : unmanaged { Console.WriteLine($"Size of {typeof(T)} is {sizeof(T)}"); } }
Show compiler warnings
[
+
]
Show input
edit mode
|
history
|
discussion