Arduino Programming Language: Sizeof

Name

sizeof()

Description

The sizeof operator returns the number of bytes in a variable type, or the number of bytes occupied by an array.

Syntax

sizeof(variable);

Parameters

  • variable: any type of variable (int, byte, long, char, arrays)

Returns

int 

Usage

Application

Examples

int a = 4;
Serial.println(sizeOf(a)); //value of a is 4

Related Functions


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc