|
|
— |
cs:c_language:basic_concepts [2020/11/26 23:18] (current) |
| ====== C Programming Languages (Basic concepts) ====== |
| |
| ===== Commented examples ===== |
| |
| - [[cs:C language:while cycle 1]]: Insert 5 numbers using the keyboard and count how many even and odd numbers have been inserted. |
| - [[cs:C language:casting]]: Some examples about mathematical expressions and casting |
| - [[cs:C language:array 1]]: Print the first even number and its position of a 10 elements array/vector. |
| - [[cs:C language:functions 1]]: Multiplication of all the elements of a vector by 3.0, using a function (parameters are passed to the function by value). |
| |
| ===== Not commented examples ===== |
| - [[cs:C language:while do-while for loops 1]]: A simple example about the utilization of the ''while'', ''do-while'' and ''for'' loops constructs to print numbers between da ''0'' and ''n''. |
| - [[cs:C language:array 2]]: find and print adjacent and equal values stored in an array |
| - [[cs:C language:functions and arrays 1]]: Pass an array to a function (by reference) and use of the library ''ctype.h''. |
| - [[cs:C language:strings 1]]: String in C and library ''string.h''. |
| - [[cs:C language:functions and matrices 1]]: Pass a matrix to a function (by reference). |
| - [[cs:C language:struct and typedef 1]]: Example of use of the constructs ''struct'' and ''typedef''. |
| - [[cs:C language:file reading 1]]: Example on how to read a file row-by-row, word-by-word, character-by-character and how to read a structured file (where field of different type are save in each row of the file). |
| - [[cs:C language:file writing 1]]: Writing data stored into structures in a file. |
| - [[cs:C language:argc and argv]]: Command line arguments |
| - [[cs:C language:write and read a binary file]]: Example on how to write or read a binary file |
| |
| ===== More specific exercises ===== |
| - [[cs:C language:printf format]]: Use of the function ''printf'' to format the output |
| - [[cs:C language:printf format inttypes.h]]: Use of the function printf to format the output of variables with fixed dimension, as defined in the <inttypes.h> library. |
| - [[cs:C language:max3]]: Compute the maximum value between 3 numbers |
| - [[cs:C language:leap year]]: Find if a year is a leap year |
| - [[cs:C language:boolean expressions]]: Examples regarding boolean expressions |
| - [[cs:C language:switch]]: The same program written in four different ways, the last by using the ''switch'' statement |
| - [[cs:C language:calc]]: Use the ''switch'' statement to realize a simple calculator |
| - [[cs:C language:sudoku]]: Solution of the sudoku game, given a ''9x9'' matrix with unknown numbers |
| |
| ===== Documentation ===== |
| - [[http://man7.org/linux/man-pages/dir_section_3.html]]: Online documentation of C functions |
| |
| Material in italian: [[it:informatica:linguaggio_c:concetti_base]] |