AuthorIlias spiros

File operations in the C language

F

A file is a dynamic structure located in the secondary memory. The C language allows the following file operations: – like text – such a file contains a line of lines separated by a newline (‘\ n’) – by binary – such a file contains a sequence of bytes without any structure. Editing a file involves associating it with an I/E channel called stream or stream...

Coding style convention in C language

C

We will try to list the things you need to keep in mind when talking about conventions; then we will go through all the C language instructions and give examples. The code must be: 1. Clear and modular The code will be divided into components, so there is a logical separation (e.g., multiple files, more functions, etc.). Each elemental logic piece will be moved to a function (which allows reuse...

Pointers in the C language

P

A pointer is a variable that holds a memory address. In C, a pointer can represent: 1. The address of a given type – elementary type, structure, string, etc. – pointer operations are determined by the size of the type of data. 2. The address of a function – address where the current execution point will jump, if that function is called 3. The address of a memory address –...

Modular programming in C

M

Ever since its appearance in the early 1970s, C has become an unchallenged leader in system programming. The latter includes a large class of programs that interact very closely with the computer and whose performance affects everyone else. A typical example of such a program is the operating system. C has several qualities that make it so much appreciated by system programmers (and not only)...

Vectors in C language

V

When we refer to the notion of a vector, we mean a linear and homogeneous collection of data. A vector is linear because data (elements) can be accessed uniquely through an index. A vector is also homogeneous because all elements are of the same type. In C, the index is a positive integer, and the indexing is from 0. The statement of a vector variable is as follows: <element_type>...

Header files in C programming

H

Operations more often used in C programming are implemented in standard or predefined functions found in the standard C library. Prototypes of standard functions, as well as other types and symbolic statement statements required to use the functions, are found in header files. These are common text files with the .h extension (from the header) and are usually stored in \TC\INCLUDE. This directory...

Functions in C language

F

Functions divide complex tasks into small pieces easier to understand and program. These can be reused on other occasions, instead of being rewritten from scratch. Functions are also useful to hide the details of running certain parts of the program, helping it work. By using functions, which represent the fundamental execution unit of C programs, a logical division of large and complex programs...

Storage classes in C

S

The storage class (memory) shows when, how, and where memory is allocated for a variable (vector). Any variable C has a memory class that results either from an explicit statement or implicitly from where the variable is defined. The memory area used by a C program includes four sub-zones: 1. Text area: where the program code is stored. 2. Data area: where global variables are allocated. 3. Stack...

Dynamic memory allocation in C

D

Standard memory allocation and release functions are usually declared in the stdlib.h header file.     -void * malloc (size_t size);     -void * calloc (size_t nmemb, size_t size);     -void * realloc (void * ptr, size_t size);     -void free (void * ptr); The three allocation functions (malloc, calloc, and realloc) result in the assigned memory allocation (void *) and as a common argument the...

C operators

C

C language operators can be unary, binary or ternary, each having a clear precedence and associativity. The following table summarizes the operators of the C language. Operators are presented in descending order of priority. Precedence Operator Description Associativity 1 Index left-right 1 . and -> left-right member selection 1 ++ and – Postincrementare / postdecrementare left-right 2 ...

Recent Posts

Archives

Categories