C index

Datatypes

Types

char
Integer is 1 byte.
int
Integer numbers 4 bytes (short is 2 bytes and long is 4 bytes)
float
Single precision floating point is 4 bytes.
double
Double precision floating point is 8 bytes.
void
Absence of type.

Data types

Integer

Allowed types are char and int;

signed char
8 bit, from -128 to 127.
unsigned char
8 bit, from 0 to 255.
char
8 bit, used to store ASCII, ex; 'h', '\n', etc...
short int
16 bit, from -32,768 to 32,767.
unsigned short int
16 bit, from 0 to 65,535.
int
32 bit, from -2,147,483,648 to 2,147,483,647.
unsigned int
32 bit, from 0 to 4,294,967,295.
long int
32 bit, from -2,147,483,648 to 2,147,483,647.
unsigned long int
32 bit, from 0 to 4,294,967,295.
long long int
64 bit, from 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
unsigned long long int
64 bit, from 0 to 18,446,744,073,709,551,615.

Real number

Real numbers are fractional numbers, all floating points are signed. Check float.h.

float
From 1e-37 to 1e37
double
Largest of floating point.
long double
The long double data maybe larger than double

Complex number

Complex Number Types

Enumeration

        enum colors {black, orange, blue} color;
        enum colors color;
        

Unions

        union accounts {
            int id;
            float value;
        } first_account, second_account;
        

Structures

        struct point {
            int x, y, z;
        } first_point;
        struct point second_point;
        

Arrays

        int account_array[9];
        int account_array[] = {0, 1, 2, 3};
        int account_array[] = {0, 1, 2, [9] = 9};
        
        int account_array[2][9] { {1,2,3},{9,8,7} }
        

Initializing string with individual characters the null character must be defined;

        char black[] = {'b', 'l', 'a', 'c', 'k', '\0'}
        
        char black[] = "black";
        
        union accounts {
            int id;
            float value;
        };
        union accounts accounts_array[9];
        accounts_array[0].id = 8;
        
        struct point {
            int x, y;
        };
        struct point point_array[9];
        point_array[0].x=2;
        point_array[0].y=3;
        

Pointers

Incomplete types

Type qualifiers

Storage class

Format Type Specifiers

%c
Character
%s
String of characters
%d
Decimal integer
%f
Decimal floating point
%llu
unsigned long long
%o
Signed octal
%u
Unsigned decimal integer
%x
Unsigned hexadecimal integer
%p
Pointer address
C Index

This is part of the LeetIO System Documentation. Copyright (C) 2021 LeetIO Team. See the file Gnu Free Documentation License for copying conditions.