User Tools

Site Tools


cs:c_language:basic_concepts

logo skenz.it

Return to Home page

C Programming Languages (Basic concepts)

Commented examples

  1. while cycle 1: Insert 5 numbers using the keyboard and count how many even and odd numbers have been inserted.
  2. casting: Some examples about mathematical expressions and casting
  3. array 1: Print the first even number and its position of a 10 elements array/vector.
  4. 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

  1. 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.
  2. array 2: find and print adjacent and equal values stored in an array
  3. functions and arrays 1: Pass an array to a function (by reference) and use of the library ctype.h.
  4. strings 1: String in C and library string.h.
  5. functions and matrices 1: Pass a matrix to a function (by reference).
  6. struct and typedef 1: Example of use of the constructs struct and typedef.
  7. 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).
  8. file writing 1: Writing data stored into structures in a file.
  9. argc and argv: Command line arguments
  10. write and read a binary file: Example on how to write or read a binary file

More specific exercises

  1. printf format: Use of the function printf to format the output
  2. max3: Compute the maximum value between 3 numbers
  3. leap year: Find if a year is a leap year
  4. boolean expressions: Examples regarding boolean expressions
  5. switch: The same program written in four different ways, the last by using the switch statement
  6. calc: Use the switch statement to realize a simple calculator
  7. sudoku: Solution of the sudoku game, given a 9×9 matrix with unknown numbers

Documentation

  1. http://man7.org/linux/man-pages/dir_section_3.html: Online documentation of C functions

Material in italian: concetti_base


If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/c_language/basic_concepts
/web/htdocs/www.skenz.it/home/data/pages/cs/c_language/basic_concepts.txt · Last modified: 2017/11/21 14:03 (external edit)

Privacy Policy