what does size of do in c code example

Example 1: terminal size in c

#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>

int main (int argc, char **argv)
{
    struct winsize w;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);

    printf ("lines %d\n", w.ws_row);
    printf ("columns %d\n", w.ws_col);
    return 0;  // make sure your main returns int
}

Example 2: what is size_t in c

/*
The datatype size_t is unsigned integral type.
It represents the size of any object in bytes and is returned by the
sizeof operator.
It can never be negative.
*/

Tags:

C Example