Variable declaration

It is recommended to declare global variables before the setup function of the code. For example:

// Global variables declaration
char str[] = "This is a string";
uint8_t number = 0;
int counter = 0;

void setup()
{ 
}  

void loop()
{
    counter++;
    USB.println(str);
    number = 121;
}

Variable types defined in <stdint.h>:

typedef signed char int8_t
typedef unsigned char uint8_t
typedef signed int int16_t
typedef unsigned int uint16_t
typedef signed long int int32_t
typedef unsigned long int uint32_t
typedef signed long long int int64_t
typedef unsigned long long int uint64_t

Last updated