C




C - Summary & Tutorial

1 • Learn to use Terminal (Shell or Bash) on Mac, Windows, Linux etc. - we will use only Mac in this tutorial (, later also Linux and Windows) - use control + c to escape or exit (leave) the running terminal activity or program - understand $ (don't write the starting $, it only stands for the last sign shown in terminal where you should start entering the code) - // stands for comment - //> means terminal output - check C version via $ gcc -v or $ gcc --version:
$ gcc --version // or $ gcc -v

//> Configured with: --prefix=/Library/Developer/CommandLineTools/usr
    //> --with-gxx-include-dir=/usr/include/c++/4.2.1
//> Apple LLVM version 8.0.0 (clang-800.0.42.1)
//> Target: x86_64-apple-darwin16.3.0
//> Thread model: posix
//> InstalledDir: /Library/Developer/CommandLineTools/usr/bin
or install C via homebrew $ install gcc - or $ reinstall gcc if already installed but older version
You can alsojust check your C version: $ cc -v

2 • write helloworld.c - compile it in terminal using $ cc helloworld.c to create file ./a.out or $ gcc helloworld.c -o helloworld to create file ./helloworld - run $ ./a.out or $ ./helloworld - learn also to use an online ide and compiler like codechef.com/ide etc.

3 • Check Homebrew version ($ brew -v) - or update newest version via $ brew update - solve all errors - or install Homebrew $ brew -v
//> Homebrew 1.1.7
//> Homebrew/homebrew-core (git revision 9df1; last commit 2017-01-13)
Now run $ brew doctor and follow the instructions on terminal - ($ brew link ... - maybe emacs, pkg-config, wget, xz etc.)

4 • Check your node version if node is already installed: $ node -v - check Install Node.js and npm using Homebrew on OS X and macOS -

5 • Learn timer.c - compile and run in terminal and online (codechef.com/ide etc.)

6 • Create a program
focus your desired idea and split it into smallest steps:

start - chosen goal: create and eat bread
provide all essential necessities: bowl - pan - plate - fire - water - flour - salt
do: put flour, salt and water in bowl - mix it and create dough
from now on repeat: form bread from dough - put pan on fire - bake dough in pan and create bread - serve bread on plate - eat bread
   if still hungry go back to "repeat",
   else if missing necessities go back to "start",
   else if not hungry anymore: end program

7 • Learn the 32 (C89) + 5 (C99) + 7 (C11) keywords or reserved words of C - how to use and how or when to write or to avoid them:
(C89) int - char const - double float - short long signed unsigned - for do - if else - while - switch case default - break continue - goto - auto register - enum - extern - return sizeof static struct typedef union void volatile --- (C99) _Bool _Complex _Imaginary inline restrict --- (C11) _Alignas _Alignof _Atomic _Generic _Noreturn _Static_assert _Thread_local
operators + - * / % = etc.,
data types like integers and char, floating-point numbers, enum, boolean, arrays, pointers, records (struct), unions etc.,
memory management, and
libraries - The C Library Reference Guide etc.




Vocabulary

bogged down - sich verzetteln, festfahren, in Einzelheiten verlieren ... p9
curb - zügeln, drosseln, einschränken, dämpfen, hämmen ... p19
extrapolate - hochrechnen, fortschreiben, extrapolieren p9
retain - behalten, sichern, anhalten, nehmen, beibehalten, aufstauen, einbehalten, zurückbehalten, aufbewahren ... - p31
supplement - ergänzen, nachtragen, aufstocken ... p9


What is the most powerful programming language and where should I go to learn it? - quora.com - C C++ Haskell Java OCaml Lisp Clojure Python Julia - Beginner C Tutorials
How long will take to learn C programming completely? quora.com
Where does 'Hello world' come from?
Where is the best place to learn C? [closed] stackoverflow
Creating Website using C programming Language - How can I make a website using c language? - quora.com
What is the best way for a beginner to learn C? - quorq.com - Arduino WP - arduino.cc - thingiverse.com - List of open-source hardware projects - BeagleBoard WP - http://beagleboard.org - https://hackerrank.com
C Programming Tutorials YT
C Programming/Standard libraries WP
C Programming WP
C11: A New C Standard Aiming at Safer Programming
The Development of the C Language - written by Dennis M. Ritchie
Object-oriented programming with ANSI-C
C Programming/GObject WP - GLib WP
CoffeeScript-like language for C/C++ - ooc-lang.org - SugarCpp
The Definitive C Book Guide and List
Computer Science - Brian Kernighan on successful language design YT
Best Programming Languages for Beginning Coders YT
Which Programming Language is The Easiest to Learn First YT
What Programming Language Should I Learn? YT
What programming language should I learn first? YT
Question: Is C a Good Programming Language to Learn? YT
Programming Fibonacci on a breadboard computer YT - megaprocessor.com




The C Programming Language

The C Programming Language 2nd Edition (ANSI C) - Brian W. Kernighan, Dennis M. Ritchie - 1988 (1st Edition 1978)

Content

Preface - 6
Chapter 1 - A Tutorial Introduction - 9
Chapter 2 - Types, Operators and Expressions - 35
Chapter 3 - Control Flow - 50
Chapter 4 - Functions and Program Structure - 59
Chapter 5 - Pointers and Arrays - 78
Chapter 6 - Structures - 105
Chapter 7 - Input and Output - 124
Chapter 8 - The UNIX System Interface - 138
Appendix A - Reference Manual - 154
Appendix B - Standard Library - 199
Appendix C - Summary of Changes - 214-217

Preface

p6 - 2nd Edition - Changes since creation of C 1978 - 1983 ANSI (American National Standards Institute) standard for C - this 2nd edition as defined by ANSI standard - ... - thanks - we use Bjarne Stroustoup's C++ translator extensively for local testing, and Dave Kristol's ANSI C compiler for final testing
p8 - 1st edition - C not very high level language nor a big one - but absence of restrictions and its generality make it more convenient and effective for many tasks than supposedly more powerful languages - ... - book ment to teach reader how to program in C - contains tutorial introduction to get new users started as soon as possible, separate chapters on each major feature, and a reference manual - all examples tested - besides showing how to make effective use of the language, we have also tried where possible to illustrate useful algorithms and principles of good style and sound design - book is not an introductory programming manual; it assumes some familiarity with basic programming concepts like variables, assignment statements, loops, and functions - nonetheless, a novice programmer should be able to read along and pick up the language, although access to more knowledgeable colleague will help - thoughtful criticisms and suggestions of many friends and colleagues have added greatly to this book and to our pleasure in writing it - thanks - Kernigham & Ritchie

Chapter 1 - A Tutorial Introduction

p9 - begin quick introduction in C - show essential elements of the language in real programs, without getting bogged down in details, rules, and exceptions - not trying to be complete or even precise (save that the examples are meant to be correct) - get reader as quickly as possible to the point where he can write useful programs, and to do that we have to concentrate on the basics: variables and constants, arithmetic, control flow, functions, and the rudiments of input and output - we are intentionally leaving out of this chapter features of C that are important for writing bigger programs - these include pointers, structures, most of C's rich set of operators, several control-flow statements, and the standard library - tutorial, by being brief, may also be misleading - more detailed descriptions ch 2

1.1 Getting Started

hello world (as for all languages) - big hurdle: create program text (editor), compile, load, run, find output ... better write: int main () - $ gcc helloworld.c -o samp --- $ ./helloworld --- terminal: Hello, world! - Wed 2015-2-25 3:58 First Hello, world! - cc hello.c - ./a.out - Hello, world!
p10 - any C program consists of functions and variables - function names free, main is special, every program must have a main -
<stdio> is standard C file input/output library - calls usually other functions - more chapter 7 and Appendix B
hello world explained:
#include <stdio.h>

main()
{
   printf("hello, world\n");
}
/* int */ main () // function name, () includes list of values, called arguments, here no arguments, empty list
// function statements enclosed in curly braces
{printf("hello, world\n");} // function printf
printf("hello, "); printf("world"); printf("\n"); p11 - identical output: hello, world - \n newline character, without > error, printf doesn't support newline character automatically - "..." character string or string constant
\t for tab - \b for backspace - \" double quote - \\ \ itself - complete list section 2.3
function main () {printf(...)} itself has no arguments, calls other library function printf with argument ("hello world\n") -
Exercise 1-1 run hello on system - experiment leaving parts, see error messages
Exercise 1-2 adding /c in "character string" shows only c -- to show /c we must write \\c

create hello.c - terminal cd ~/... (directory of hello.c) - cc hello.c // creates a.out - $ gcc hello.c -o hello // creates hello - now test it:
$ ./a.out
//> hello, world
$ ./hello
//> hello, world

now change in hello.c first a.out to "hello, world1", and then hello to "hello, world2":
$ cc hello.c // before changed hello.c with "hello, world1"
$ ./a.out
//> hello, world1
$ gcc hello.c -o hello // before changed hello.c with "hello, world2"
$ ./hello
//> hello, world2
and test again a.out:
$ ./a.out
//> hello, world1 // remained world1
open hello.c - open it in Google Chrome browser, and then via View Page Source (right-click on page -> opens in new tab) to also view the line numbers
read the compiled hello file in machine code (reconverted to html via text editor Komodo Edit version 10.1.4) :-)
download compiled hello file and read it in your text editor :-) Or open downloaded file in

1.2 Variables and Arithmetic Expressions

formula °C = 5/9 (°F - 32) --> celsius = 5 * (fahr-32) / 9 --- °F = °C x 9/5 + 32 --- print table of Fahrenheit or Celsius
#include <stdio.h>

/* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */
main()
{
   int fahr, celsius;
   int lower, upper, step;

   lower = 0; /* lower limit of temperature scale */
   upper = 300; /* upper limit */
   step = 20; /* step size */

   fahr = lower;
   while (fahr <= upper) {
      celsius = 5 * (fahr-32) / 9;
      printf("%d\t%d\n", fahr, celsius);
      fahr = fahr + step;
   }
}
open this C file here: 1.2.1_fahr_cels.c
p12 - comments /* */ where a blank, tab or newline can
p13 - in C all variables must be declared before used - data types: int float char short long double - they are part of arrays, structures, unions, pointers to them, functions that return them - will meet soon - range of int and float
depends on machine, 16 bit (-32768 to 32767) or 32 bit ( 10-38 to 1038) etc., start program with assignment statements: lower = 0; upper = 300; step = 20; sets variables to their initial values, terminated by semicolons.
while loop repeats once per output: while (fahr <= upper) {...} --- single statements don't need braces: while (i < j) i = 2 * i;
#include <stdio.h>

int main()
{
   int i, j;
   j=30; i=1;

   while (i < j) {
      i = 2 * i;
      printf ("%d", i);
      printf("\n");
   }

   printf("\n" "End of instruction\n\n");
}
Output: 2
4
8
16
32

End of instruction
open this C file here: 1.2.2_while_i_smaller_j.c
Exercise: Why does it print up to 32 if j=30 and i<j?
Recommendation: write only one statement per line, and use blanks around operators to clarify grouping - braces different styles possible - use your style consistently

5/9 would be 0 in C and many other languages - therefore not just muliplied by 5/9, it truncates: any fractional part is discarded - %d specifies an integer argument, /t puts tab
p14 - printf is part of <stdio.h>, not C - talk about io (input/output) in chapter 7 - input (scanf) in chapter 7.4
2 problems: 1. Output numbers not right-justified - correct by 3 or 6 digit wide field:
printf("%3d %6d\n", fahr, celsius); 2. Celsius temperatures not very accurate (0°F = about -17.8°C) - use floating-point arithmetic - change the lines:
   celsius = (5.0/9.0) * (fahr-32.0);
   printf("%3.0f %6.1f\n", fahr, celsius);
5.0/9.0 now not truncated because of floating-point -
printf first floating-point number with no decimal point and no fraction digits, second with 1 digit after point. %6f says number is to be at least six characters wide, %.2f specifies 2 characters after decimal point, %f prints number as floating point - %o for octal, %x for hexadecimal, %c for character, %s for character string, %% for itself
Output:
0 -17
20 -6
40 4
60 15
80 26
100 37
120 48
140 60
160 71
180 82
200 93
220 104
240 115
280 137
300 148

Exercise 1-3. Modify the temperature conversion program to print a heading above the table.
Enter this or other on top of main: printf("fahr to cels\n"); Exercise 1.4. Write a program to print the corresponding Celsius to Fahrenheit table.

1.3 The for statement

Different ways to write program - variation on temperature converter:
#include <stdio.h>

/* print Fahrenheit-Celsius table */ main()
{
   int fahr;
   for (fahr = 0; fahr <= 300; fahr = fahr + 20)
      printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32));
}
Output:
  0   -17.8
 20    -6.7
 40     4.4
 60    15.6
 80    26.7
100    37.8
120    48.9
140    60.0
160    71.1
180    82.2
200    93.3
220   104.4
240   115.6
260   126.7
280   137.8
300   148.9




1.4 Symbolic Constants

...
#define ... // no semicolon at end of line
...

1.5 Character Input and Output

many programs prototypes of following:
c = getchar(); putchar(c); --- c !=EOF // not equal to end of line
#include <stdio.h>

/* copy input to output; 1st version */
main()
{
   int c;

   c = getchar();
   while (c != EOF) {
      putchar(c);
      c = getchar();
   }
}

Also can be written as:
#include <stdio.h>

/* copy input to output; 2nd version */
main()
{
   int c;

   while ((c = getchar()) != EOF) // () because precedence of != higher as =
      putchar(c);
}
...

1.5.2 Character Counting


* * * * * * * * * * * *

Installations

Install Homebrew - check version: $ brew --version
//> Homebrew 1.1.6
install node and npm and check version: $ brew install node
$ node -v
//> v7.4.0
$ npm -v
//> 4.0.5


Links

games.lovetheuniverse.com/c.html
Yann Dauphin, Researcher and Bass player - Khan Academy :-) ♡
Difference between CC, gcc and g++? - stackoverflow




Arduino

Access the Online IDE - TW 217K - login to Web Editor - download and install plugIn - Web Editor
How Arduino is open-sourcing imagination | Massimo Banzi
Genuino Starter Kit [English] - €79.90 + VAT - Arduino Starter Kit - Video Tutorials by Massimo Banzi
Thinking About Getting an Arduino? Watch This
Which is the best microcontroller for beginners? quora.com - What is a Microcontroller YT
Top 10 Arduino Projects YT - Top 5 Robot Arduino Projects
Arduino RGB LED control using Bluetooth
6 Things You WONT Believe ROBOTS Can Do
maker-store.de - Danziger Str. 22, 10435 Berlin - Arduino Coding Set | Brick 'R' knowledge & Arduino
grund-wissen.de - Grundwissen Elektronik PDF - Elektronik mit Arduinos (Seite 103)
Arduino-Tutorial von Frerk Popovic
Arduino Starter Kit Unboxing - Arduino Starter Kit Color Mixing Lamp Project




Programming in C

Stephen G. Kochan - 3rd Edition

R p1-10

3 - Compiling and Running Your First Program

p11 - program 3.1 Hello world (Programming is fun.) - int main (void) ... return 0;
lower and upper case distinct - free blank space and tabs
p12 - editor to write .c file - compile with GNu $ gcc "filename".c - or standard Unix C compiler $ cc "filename".c - executable version $ ./a.out - or specify different name for saved file: $ gcc "prog1"filename".c –o "free chosen filename" - execute $ ./"chosen filename" - if program in path just enter $ a.out or $ "chosen filename" (check this out What it is and How to Modify the Shell Path in macOS Sierra and OSX using Terminal etc.)
p13 - Hello world explained - (void) is keyword, specifies that function takes no arguments, "void" of arguments - return 0; returns to system value 0, this indicates that program completed without error - other numbers can be used for different error types (like file not being found etc.) - can be tested by other programs (Unix shell etc.)
p15 - program 3.4 - int sum; - variables must be declared before before they are used in a program - int stands for integral number, values without decimal places (3, -8, 0 ...) - 3.14 etc. are called floating-point or real numbers
p16 - printf ("The sum of 50 and 25 is %i\n", sum); - 2 arguments in printf, separated by comma - % is special character recognized by printf function, character that follows % specifies type to be displayed - i stands for integer - %i displays automatically value of next argument, here sum
program 3.5 printf ("The sum of %i and %i is %i\n", value1, value2, sum); - 4 arguments
%d also prints integers - book only uses %i
p17 - Comments - // or /* */ etc.
p19 - Exercises - 5.
#include <stdio.h>

int main(void) {
int sum;
// COMPUTE RESULT
sum = 25 + 37 - 19;
// DISPLAY RESULTS
printf ("The answer is %i\n", sum);

return 0;
}

//> The answer is 43
Exercise 6. - The result is 95

4 - Variables, Data Types, and Arithmetic Expressions

p21 - Computer programmers had to write programs binary and assign and reference storage locations in computer's memory - today's programming: symbolic names (variables) to store computations and results - free choosable, should represent type of value and meaning - C allows different data types, declaration for variable must be made before usage in program: floating-point, characters, pointers (to locate memory)
rules: begin with letter or _ (underscore), followed by any combination of letters (upper- or lowercase), underscores. or the digits 0-9 - examples: sum pieceFlag i J5x7 Number_of_moves _sysflag
not allowed: space, $, 3 or number at beginning, int or keyword (reserved word - see Appendix A)
lower- and uppercase difference: sum Sum SUM etc. - as long as we wish, better not too long - first 63 or 31 characters might be significant - be meaningful
Understanding Data Types and Constants
p23 - int (integral) float (floiting-point numbers) double (double precise as float) char (a, 6, ; etc.) _Bool (0 or 1)
constant in C is any number, single character, or character string - constant expression: 128 + 7 - 17, only constant values - 128 + 7 - i is not
The Basic Integer Type int
In C integer constant = sequence of one or more digits - minus sign indicates value negative - 158, -10, 0 valid examples - no embedded space between permitted, larger than 999 can't be expressed using commas
Two special formats in C: octal = base 8: first digit must be 0 (zero, not letter O), remaining digits only from 0-7 - decimal 40 makes octal 50 (5x8 + 0x1) etc. - octal 0177 = decimal 127 (1x64 + 7x8 + 7x1) - integer can be displayed in octal notation using format characters %o (letter o lower case) in the format string of a printf statement, displayed without leading zero - format characters %#o cause leading zero before octal value
hexadecimal = base 16 - before integer must be 0x or 0X (zero and x lower- or uppercase)
p24 - following hex digits composed from digits 0-9 and letters a-f or A-F for 10-15 - example: rgbColor = 0xFFEF0D; - format characters %x display hex without leading 0x using lowercase letters - with leading 0x use %#x - printf ("Color is %#x\n", rgbColor); - create uppercase with %X or %#X
Storage Sizes and Ranges
machine-dependent - minimum 32 bit for integer, size of a word - more see table A.4 Appendix A
The Floating Number Type float
decimal-point can be before, between or after digits, not both - 3., 125.8, and –.0001 are valid examples - printf %f - also for scientific expressions like 1.7e4 is 1.7 x 10-4 (before e called mantissa, after exponent) - ... - e lower- or uppercase
p25 - better use %g, printf decides of display normal or scientific, if less than -4 or grater 5 uses %e, otherwise %f - hexadecimal floating 0x followed by p or P, followed by signed binary exponent - example: 0x0.3p10 = 3/16 x 210 = 192
The Extended Precision Type double
similar to float - used if range of float variable is not sufficient - can store roughly twice as many digits as type float - most computers represent double values using 64 bits - compiler mostly takes all floating-point constans as double, to express explicitly float use f or F at end of number: 12.5f - to display double value, format characters %f, %e, or %g, same as used by float, can be used
The Single Character Type char
...
The Boolean Data Type _Bool
...
Type Specifiers: long, long long, short, unsigned, and signed
...

Working with Arithmetic Expressions

In C, just as in virtually all programming languages, + sign to add, - subtract, asterisk * to mutiply, / slash to divide - known as binary arithmetic operators because working on two values - precedence (more in Appendix A complete list and rules of association)
program 4.2
...
p32 - some computers x/0 results in abnormal termination or error - chapter 6 shows more /0 (happens under gcc under Windows, Unix might give () as result of i/0 and "Infinity" result for float/0) - a+b*c=150 - can change precedence via () - (a+b)*c=2550 - parentheses can be nested (a + 2) * ((8 - 5) / x)) - Program 4.2 last expression given as an argument to printf without first assigning result to variable
Integer Arithmetic and the Unary Minus Operator
p33 - Program 4.3
...
decimal portions lost 25/2*2=24 instead of 25, because 12.5 becomes 12 - correct with float - only use float if needed, slows down - unary minus operator - unary because only bound to single value, instead of binary to two values - unary minus has higher precedence than all other operators, except unary plus, same precedence (more Appendix A)
The Modulus Operator
p35 - 25 % 7 = 4 --- printf("%%) // prints % --- remainder of first value divided by second - program 4.4:
// The modulus operator

#include <stdio.h>

int main (void)
{
   int a = 25, b = 5, c = 10, d = 7;

   printf ("a %% b = %i\n", a % b);
   printf ("a %% c = %i\n", a % c);
   printf ("a %% d = %i\n", a % d);
   printf ("a / d * d + a %% d = %i\n",
      a / d * d + a % d);

   return 0;
}
Output:
a % b = 0
a % c = 5
a % d = 4
a / d * d + a % d = 25
p 36 - last line see chapter 10 "Character Strings" - operations between integer values in C are performed with integer arithmetics - 25 / 7 gives 3 --- a / b * b + a % b always equals a, if a and b are integers --- % has equal precedende to to * and /
Integer and Floating-Point Conversions




Vocabularies

contrived - erfunden, gestellt, arrangiert, gekünstelt - p17
dismay - Bestürzung, Betroffenheit ... - p18
intricacies - Feinheiten, Komplikationen - p19
reap - ernten, mähen, einheimsen, erlangen, einheimsen ... - p18
reinforce - verstärken, bekräftigen, bestätigen ... - p33
relish - etw. genießen, gern mögen, mit Behagen essen - p19
tedious - öde, langweilig, ermüdend, lästig ... - p19
virtually - so gut wie, geradezu, nahezu, praktisch, fast, gewissermaßen ... - p30




Memory as a Programming Concept in C and C++

Chapter 1 - Introduction

p9 - programs executed in computer memory - people lack understanding of intricate relationship between program and memory - book about all fields involved in topic: operating systems, computer architechture, compilers, principles of programming languages, C and C++ programming - reader should have intermediate level of programming skills in C or C++ - interest not in memory as such, but as a concept and it's role in programming and behaviour of C and C++ programs - readers results: understand differences between compile/run-time and index range checking between C/C++ and Pascal - recursive/nonrecursive prodedure calls in C/C++ and Fortran - appreciate why Java garbage-collection and C/C++ not - C/C++ can't be interpreted like Java - C/C++ has pointers, Java not - all these aspects are related to memory and its use
p11 - ... - chapters content - ...

Chapter 2 - From Source File to Executable File

p16 - ... - high-level languages only invented for simpler programming -


Links

I need to learn C programming in 20 days. What online video, lectures, or dedicated websites should I follow?
C Tutorial - tutorialspoint
cprogramming.com

Terminal Cloud 9 - CS50




C

Codechef compiler

p9 - Hello world
#include <stdio.h>

main() {
printf("hello, world\n"); }

p10 - C program consists of functions (containing statements) and variables (storing values). The main () function is special, program begins to execute at beginning of main () - so every program must have a main () somewhere.
Hello world - explanation - functions provide list of arguments in parantheses () - here empty means no arguments - statements in {} - here printf("hello, world\n"); - \n means new line character - printf is a library function - "hello, world\n" is a string (character string or string constant) - without \n (newline character) we get an error
Other hard-to-type or invisible characters are \t for tab, \b for backspace, \"" for the double quote and \\ for the backslash itself - complete list in Section 2.3

p11 - 2 exercises done
1.2 Variables and Arithmetic Expressions
Fahrenheit Celsius tables


install npm




Testing .c files

1 • helloworld.c
2 • timer.c




Grundkurs C

grund-wissen.de Grundkurs C - PDF p1-98 complete content ♡ - Bernhard Grotz - Version 0.2.0c - aktualisiert am 06.12.2016

Einführung
p1 - Editor Compiler - hello, world - save as hallo.c - void main() (kein Rückgabewert der im Programm zu verwerten wäre) - // /* */ - #include <stdio> gilt dem preprocessor -
p2 - function Inhalt immer mit ; beenden - compile $ gcc hallo.c -o hallo - -o zur Benennung der Output-Datei - Aufruf mit $ ./hallo - output //> hello, world - erstes C Programm fertig gestellt

Definition von Variablen
p3 - Vorteil Computer gegen Taschenrechner: kann nahezu beliebig viele Werte in Variablen speichern und verarbeiten - Prozessor liest nur Maschinensprache - alles binär darstellen - Computer unterscheidet Zeichen oder Zahl als binäre Darstellungen, daher muss man mitteilen wie Inhalt der Variable zu interpretieren ist - Deklaration der Variablen (+ Speicherplatz) muss zu Beginn einer Datei oder durch geschw. Klammern {} begrenzten Code-Blocks definiert werden - gültig bis im Progr. abgearbeitet (außer durch static) - Def. Beisp.: int n; - oder int x,y,z; - Initiation mit Inhalts-Zuweisung: int c = 256; ---
p4 - = Zeichen speichert Wert in Varible ab (Wertevergleich wie in Mathe durch ==) - wiederholte Datentyp-Angabe führt zu error (Compiler lehnt scheinbar doppelte Variablenname-Vergabe ab) - Var.-Namen in C nur 31 Stellen lang, aus A-Z a-z 0-9 _, anfangs Ziffer verboten, anfangs _ meiden da üblicherweise für für Bibliotheksfunktionen reserviert - C ist case sensitive - functions in C fast immer klein - Datentyp nur einmal pro Var. am Anfang angeben, dann nicht mehr
Grundlegende Datentypen in C:
char (einzelnes Zeichen, 1 byte) - int (ganzzahlige Zahl, 4 byte) - short (ganzz. Zahl, 2 byte) - long (ganzz. Zahl, 8 byte) - float (Kommazahl, 4 byte) - double (Kommazahl, 8 byte) - Speicherbedarf abhängig von Rehnerarchitektur, hier für 32-Bit-Systeme angegeben, Größe je nach Rechner kann mit sizeof() geprüft werden: (file sizeof.c - printf("Size of char: %lu\n", sizeof(char) ); etc. - compile - Umwandlungszeichen %lu (entspricht long integer) wird durch Rückgabewert von sizeof() ersetzt
"Boolescher" (boolean) Datentyp (True/False) existiert in C nicht - stattdessen Wert Null für False und jeder von Null verschiedene als True interpretiert
Komplexere Datentypen dieser elementaren Datentypen durch Aneinanderreihungen/Felder (arrays) oder Definitionen von Strukturen (structs) erzeugen.
Zusätzlich Datentyp void, null bytes groß, wird z.B. genutzt wenn Funtkion keinen Wert als Rückgabe liefert
Modifier
p5 - Alle grundlegenden Datentypen (außer void) können zusätzlich mit einem der folgenden modifier versehen werden:
signed / unsigned - extern - static - auto / register - const - volatile --- z.B. bei 1 byte (8 bit) signed char Werte von -128 bis +128 abbildbar - unsigned char Werte von 0 bis 255 - werden üblicherweise als ASCII-Codes interpretiert --- extern nutzt Speicherplatz einer in anderer Quelldatei genutzten Speicherplatzes, Var.-Name aus ext. Datei muss in Header angegeben sein ---
p6 - static erhält gespeicherten Variablen-Wert auch wenn Funktion beendet wird und kann bei Wiederaufruf erneut genutzt werden - wird Variable zu Beginn der Datei mit static versehen, können alle Funktionen der Datei zugreifen, nicht aber andere Dateien - umgekehrt ist jede Funktion und jede außerhalb einer Funktion definierte Variable "global" wenn nicht mit static versehen - Glob. Var. sollten vermieden werden da von vielen Stellen aus manipulierbar, Fehler dadurch dann im Code schwer zu orten --- auto / register - üblicherweise interpretiert Compiler Var. als auto, daher wird auto meist weggelassen - durch register wird Compiler gesagt Var. nicht im ext. Arbeitsspeicher, sondern im Prozessorspeicher abzulegen, dadurch schneller Zugriff, Prozessorspeicher wird aber wegen Begrenztheit vom Compiler als auto umgeschreiben --- durch const wird auf Var. nur lesend zugegriffen, Schreib-Zugriff möglich aber abgeraten, da Ergebnis undefiniert - kann auch durch define festgelegt werden - ASCII-Zeichen wie a-z A-Z und Sonderzeichen sind auch Konstanten ---
p7 - volatile zwingt Compiler Var.-Wert nicht zwecks Optimierung zu ändern, da Var. sich ändern kann wider Erwarten des Compilers, Bsp.:
volatile int Tastenzustand;
Tastenzustand = 0;
{ // Warten auf Tastendruck}
Ohne volatile könnte Compiler Endlosschleife erzeugen, da er nicht wissen kann dass sich Tastenzustand während Schleife ändern kann

Zeiger und Felder (pointer and arrays)
p8 - Zeiger (pointer) lassen Var. nicht direkt ansprechen, sondern durch eigenständige andere Var., deren Inhalt Speicheradresse einer anderen Var. ist - Definition legt Typ fest: int *n; oder mehrere: int *x, *y, *z; durch Kommata getrennt, Abschluss Strichpunkt




Computer Architecture

Computer hardware WP - Computer architecture WP
Free Software Foundation
Homebuilt computer
Best DIY computer kits 2017 UK: Raspberry Pi, Arduino, Microbit, Fuze & more
Arduino vs Raspberry Pi vs BeagleBone vs PCDuino
How to Pick the Right Electronics Board for Your DIY Project - Arduino, Raspberry Pi, BeagleBone
BeagleBoard WP - beagleboard.org

Kano (computer) WP - kano.me


Computer parts

Processor Memory I/O




Algorithms and Data Structures

Algorithms and Data Structures © N. Wirth 1985 (Oberon version: August 2004)

Compiler WP - Object code WP - Machine_code WP - Niklaus Wirth WP - Algorithms + Data Structures = Programs WP

Contents
Preface - 7
1 Fundamental Data Structures - 11
2 Sorting - 45
3 Recursive Algorithms - 87
4 Dynamic Information Structures - 109
5 Key Transformations (Hashing) - 177
Appendices - 183
A The ASCII Character Set
B The Syntax of Oberon
Index

Preface
p7 - E.W. Dijkstra's "Notes on Structured Programming" - C.A.R. Hoare's "Axiomatic Basis of Computer Programming" and "Notes on Data Structuring" - the subjects of program composition and data structures are inseparably interwined - book in Pascal lang
...
p9 - book "Systematic Programming" provides ideal background, based on Pascal notation - ...
Preface To The 1985 Edition
Pascal replaced by Modula-2 (Pascal is ancestor) - Modula-2 WP - ... -
p10 - book was edited and laid out by the author with the aid of a Lilith computer and its document editor Lara

Notation
& denotes conjunction, pronounced and
~ denotes negation, pronounced not
Boldface A and E used to denote the universal and existential quantifiers
In the following formulas, the left part is the notation used and defined here in terms of the right part. Note that the left parts avoid the use of the symbol "...", which appeals to the readers intuition.
Ai: m ≤ i < n : Pi    ≡    Pm & Pm+1 & ... & Pn-1 The Pi are predicates, and the formula asserts that for all indices i ranging from a given value m to, but excluding a value n, Pi holds. Ei: m ≤ i < n : Pi    ≡    Pm or Pm+1 or ... or Pn-1 The Pi are predicates, and the formula asserts that for some indices i ranging from a given value m to, but excluding a value n, Pi holds. MIN i: m ≤ i < n : xi    =    minimum(xm, ... , xn-1) MAX i: m ≤ i < n : xi    =    maximum(xm, ... , xn-1)

1. Fundamental Data Structures

1.1. Introduction




Vocabulary
abundantly - reichlich, mächtig, im Überfluss, in Hülle und Fülle ... - p7
amenable - zugänglich, empfänglich, biegsam, gefügig, zugängig, offen - p7
bearing - Bedeutung, Tragweite, Bezug, Zusammenhang ... - p7
crucial - entscheidend, kritisch, wichtig, ausschlaggebend, äußerst wichtig ... - p7
elaboration - Vervollkommnung, Ausarbeitung, sorgfältige Ausführung, ausführliche Darstellung ... - p9
hitherto - bisher, bisherig, wie bisher - p7


Program Development by Stepwise Refinement

Program Development by Stepwise Refinement -


Links

Algorithm WP
Alan Turing WP - ALAN TURING YT - Alan Turing - Celebrating the life of a genius YT




The Algorithm Design Manual

Best algorithms book I ever read - Eric Wendelin WS - TW 1.2K - created stacktracejs.com - Who's Bigger? WP - whoisbigger.com - iTunes App
The Algorithm Design Manual - 2nd edition 2008 by Steven S. Skiena WP - Jesus the Game Changer Steven Skiena Segment 1 YT - CSE373 2012 - Lecture 01 - Introduction to Algorithms
Algorithms and Data Structures Course by Robert Sedgewick - YT
What are the best books on algorithms and data structures? quora.com

Preface
V - Designing correct, efficient, and implementable algorithms for real-world problems:




Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications 7th Edition - Kenneth Rosen - Solutions Guide
How should I read Kenneth H. Rosen's Discrete Mathematics effectively? quora.com
Discrete mathematics WP
What is the best book for studying discrete mathematics? math.stackexchange.com
Concrete Mathematics: A Foundation for Computer Science - 2nd Edition - Ronald L. Graham, Donald E. Knuth, Oren Patashnik
Discrete and Combinatorial Mathematics: An Applied Introduction - scribd.com - Ralph Grimaldi WP
Who has read Discrete Mathematics and Its Applications and did you feel it helped you learn discrete math well? reddit.com
Discrete Mathematics with Applications - 4th Edition - Susanna S. Epp WP

Chapter 1-13 - pages 1-903 - Appendixes - Books - Answers - Index

1 - The Foundations: Logic and Proofs
1.1 - Propositional Logic
p1 - examples ...
p3 - proposition p (or q, r, s ...) is T (true) or F (false) - ¬p is negation of p, read "not p" - Def 1: if p T, then ¬p F --- if p F, then ¬p T --- logical operators are called "connectives"
p4 - Def 2: if p and q are T, the conjunction ∧ of p and q, p ∧ q, is also T, otherwise F - in conjunctions sometimes "but" is uses instead of "and": The sun is shining, but it is raining
Def 3: disjunction ∨ (read or) is true if p or q are true, or both,
but false if both are false --- p ∨ q
p ∧ q has 4 possible results: TFFF - p ∨ q has 4 possible results: TTTF
p5 -




How to Prove It

A Structured Approach

Daniel J. Velleman - Department of Mathematics and Computer Science at Amherst College, three hours north of New York City - Ph.D., University of Wisconsin-Madison (1980) - M.A., University of Wisconsin-Madison (1977) - B.A., Dartmouth College (1976) - A.M. (honorary), Amherst College (1992) - Second Edition

Proof writing artofproblemsolving.com - Proof Designer (Java)
Case Study: How I Got the Highest Grade in my Discrete Math Class

Content
Preface (pIX) - Introduction (p1) - 1 Sentential Logic (p8) - 2 Quantificational Logic (p55) - 3 Proofs (84) - 4 Relations (p163) - 5 Functions (226) - 6 Mathematical Induction (p260) - 7 Infinite Sets (p306) - Appendix 1: Solutions to Selected Exercises (p329) - Appendix 2: Proof Designer (p373) - Suggestions for Further Reading (p 375) - Summary of Proof Techniques (p376) - Index (p381-384 end of book)

Preface
pIX - What distinguishes correct from incorrect proof - students learn proofs in high school like in former computer science from "list of instructions" to present "structured programming" - we may say book teaches "structured proving" - structured progr. not only listing instructions, but combining basic structures (if-else, do-while) and also nesting them - example:
do
   if [condition]
      [List of instructions goes here.]
   else
      [Alternate list of instructions goes here.]
while [condition]
... pXII end

Introduction
p1 - math as deductive reasoning -




Calculus

Calculus WP
What are the best calculus books? quora.com
The most enlightening Calculus books
Thomas' Calculus: Multivariable - 13th Edition - George B. Thomas WP
Calculus: Early Transcendentals - 8th Edition - James Stewart WP - What is the difference bt James Stewart's "Calculus" & "Calculus: Early Transcendentals"? Which is better?
What's the difference between early transcendentals and late transcendentals?
Essential Calculus 2nd Edition - Inspiration and Application of Calculus with James Stewart YT
Calculus - 4th edition - Michael Spivak WP
Calculus - Basic Concepts for High School - 1982 by L.V. Taraso
Best calculus textbook? physicsforums.com

Calculus

Michael Spivak alchetron.com - WP
I'm not finding easy to follow Apostol's or Spivak's book on calculus. What should I do? quora.com




Mathematics

Donald Knuth - My advice to young people (93/97) YT - Donald Knuth WP - TeX typesetting system WP - mathjax.org - MathJax (TeX for Web) - Getting Started - MathJax TeX and LaTeX Support - ctan.org
Surreal Numbers - 1st Edition by Donald E. Knuth - how two ex-students turned on to pure mathematics and found total happiness - a mathematical novelette - full text at archive.org - WP
John Horton Conway WP - On Numbers and Games


Concrete Mathematics

Dedicated to Leonhard Euler (1707 - 1783) - WP

"...Concrete Mathematics is a blending of CONtinuous and disCRETE mathematics. "More concretely," the authors explain, "it is the controlled manipulation of mathematical formulas, using a collection of techniques for solving problems."

Concrete Mathematics: A Foundation for Computer Science - 2nd Edition by Ronald L. Graham (Author), Donald E. Knuth (Author), Oren Patashnik (Author)
CM safaribooksonline.com
The Art of Computer Programming, Volumes 1-4A - Boxed Set 1st Edition by Donald E. Knuth
Concrete Mathematics: A Foundation for Computer Science - Community reviews - goodreads.com
What books do you recommend before 'Concrete Mathematics'? stackexchange.com
What are some opinions on Concrete Mathematics by Donald Knuth? quora.com - Stockholm syndrome

pV - based on course at Stanford University (California) since 1970 - CM born in dark and stormy decade - Knuth missed math tools, created this course - CM was antidote to Abstract Math (concrete classical results wiped out by New Math) -
pVI - CM blend of CONtinuous and disCRETE math - controlled manipulation of math formulas, using collection of techniques for solving problems - if material of book is learned, reader will solve everything only on paper with handwriting! - major topics treated in this book include sums, recurrences, elementary number theory, binomial coefficients, generating functions, discrete probability, and asymptotic methods - will become familiar with discrete math as student of calculus with continuous operations (like absolute-value function and infinite integration) - original course textbook was "Mathematical Preliminaries" from TAOCP - 110 pages quite terse, OP (author) drafted supplementary notes, this book is outgrowth -
pVII - book is kind of manifesto about our (authors) favorite way to do mathematics, turned out to be a tale of mathematical beauty and surprise - we think math is not cold and dry, but fun, no line between work and play needed - margins include direct quotations from famous mathematicians, actual words in which they announced some of their fundamental discoveries -
pVIII - more than 500 exercises in six catgories: warmups, basics, homework exercises, exam problems, bonus problems - research problems - answers in Appendix A - math typeface by Hermann Zapf, like handwriting, called AMS Euler - Concrete mathematics is Eulerian mathematics -
pIX - Thanks to: ... 16 years' lecture notes - notes to 2nd edition ... - $ 2.56 for mistakes
pX - notation of symbols and pages where they are explained:
lnx --- lgx --- log x --- ⌊x⌋ --- ⌈x⌉ --- x mod y --- {x} --- (sum)f(x) δx ---
(sumba)f(x) δx --- xn --- xn --- n¡(! usidedown) --- Rz --- Iz --- Hn --- Hn(x) ---
pXI - f(m)(z) --- [n(/)m] --- {n(/)m} --- <n(/)m> --- <<n(/)m>> --- (am, ...,a0)b ---
K(a1,...,an) --- F(a,b(/)c|z) --- #A --- [zn] f(z) --- [α..β] --- [m=n] --- [m\n] ---
[ m\\n ] --- [m⊥n] ---
--- '...' for written, "..." for spoken text, string of 'string' is called "string" -
expression 'a/bc' is same as 'a/(bc)' --- log x/log y = (log x)/(log y) --- 2n! = 2(n!)
pXII-XIII - Contents - 1 Recurrent Problems (p1=20p) - 2 Sums (p21=45p) - 3 Integer Functions (p67=34p) -
4 Number Theory (p102=50p) - 5 Bionomial Coefficients (p153=103p) - 6 Special Numbers (p257=62p) -
7 General Functions (p320=60p) - 8 Discrete Probability (p381=57p) - 9 Asymtotics (p439=57p) -
A Answers to Exercises (p497=106p) - B Bibliography (383 books) (p604=32p) - C Credits for Exercises (p632=4p) -
Index (p637=19p) - List of Tables (p657=1p=end of book)

1 Recurrent Problems

p1 - chapter 3 sample problems - all investigated repeatedly by mathematicians, solutions use recurrence, depending on solutions to smaller instances
1.1 The tower of Hanoi - invented by French math. Edouard Lucas 1883 (bk260) - tower of 8 disks, stacked in decreasing size on one of three pegs - transfer entire tower to one of the other pegs, moving only one disc at a time, never moving larger one onto smaller - Lucas furnishes to tower of Brahma, 64 disks of gold on 3 diamond needles, God asks at beginning of time priests to transfer according to same rules above, priests work day and night, when finish tower will crumble and world will end -
p2 - best to do: how many moves necessary and sufficient to perform task - best way to tackle a question like this is to generalize it: Brahma tower 64 discs, Hanoi 8 - consider n discs - we'll see repeatedly in book: it's advantageous to "look at small cases" first - easy transfer tower of 1 ore 2 discs, then 3, and 0 - next step introduce appropriate notation: name and conquer - Tn is minimum number of moves to transfer n disks according to rules - then T1 = 1, T2 = 3, (T3 = 7 etc.) - T0 = 0 is smallest case - now think big:





Vocabulary

enfeeblement - Entkräftung, Schwächung - pV
hotbed - Brutstätte, Frühbeet, Mistbeet ... - pV
peg - Aufhänger, Stift, Stöpsel, Zapfen, Pflock, Wirbel (Musik), Dübel ... - p1
recurrent - periodisch, wiederkehrend, rekurrent ... - p1
rift - Riss, Kluft, Spalte, Graben - WP Carl Friedrich Gauss --- reef, ledge, shelf - Riff
scrutiny - genaue Überprüfung/Untersuchung ... - pV
spawn - vermehren, erzeugen, hervorbringen, laichen - pV
tackle - bewältigen, anpacken, in Angriff nehmen, angehen, fertig werden ... - p2
trait - Eigenschaft, Zug, Charakterzug, Wesenszug, Gesichtszug, Charaktereigenschaft, Charakteristik, Merkmal - p1


LaTeX Symbols artofproblemsolving.com - LaTeX Commands

TeX Demo 1:
When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

Demo 2:
$$ (2\pi h)^{-d}\iint_{\{H(x,\xi) <\tau\}} dx d\xi $$

Demo 3:
$$ \sum \int \oint \prod \coprod \bigcap \bigcup \bigsqcup \bigvee \bigwedge \bigodot \bigotimes \bigoplus \biguplus $$


• Session 1 • Tue 2017-1-31 Berlin 8:45-11:40, 15:10-18:15, 18:40-19:50, 20:50-22:25 start Concrete Mathematics WR pV-XIII ♡♡♡ + colors + formatting ♡♡♡ 23:35 start ch1 R p1-16 - WR p1-2 3:25 end of session




Structured Computer Organization

Fifth edition - Andrew S. Tanenbaum

Andrew S. Tanenbaum WP - Structured Computer Organization (6th Edition) - Amazon - MINIX WP - Andrew S. Tanenbaum: The Impact of MINIX YT
Modern Operating Systems The Minix Book - (4th Edition) - Amazon - Computer Networks (5th Edition) - Amazon - Operating Systems - Design and Implementation (3rd Edition)
Computer WP - Microprocessor WP - Microcontroller WP
Pentium (WP) - x86-compatible microprocessors - Intel (WP) founded 1968 - x86 since 1993 - Santa Clara, California
ARM architecture WP - Acorn/Advanced RISC Machine - start 1983 - in mobile devices
UltraSPARC III - since 2001 - designed by Sun Microsystems and manufactured by Texas Instruments - SPARC64 V - in future will implement the ARMv8 architecture
Intel MCS-51 - (commonly termed 8051) - since 1980
Instruction set WP - ISA (Architecture)

Programming Languages -- Past Achievements and Future Challenges Niklaus Wirth u.a. - Euler Algol_W Pascal Modula Oberon Lilith_OS Oberon_OS Lola_digital_hardware ACM_Turing_Award PL/0_compiler_design 29:00 simpler but more powerful
Systems Architecture, Design, Engineering, and Verification




Links

cs - computer science Harward CS50 David J. Malan ♡♡♡
c-howto.de - eliasfischer.de - lebeblog.de - YT - Wie finde ich das Ziel, das ich wirklich will? - TW - Antworten zu mir, meinem Leben und meiner Arbeit - FB - Wer bin ich wirklich? - Elias Fischer FB

lesscss.org - lesscss.de JS-based - sass-lang.com Ruby-based - CSS Preprocessors – Sass vs LESS - stylus-lang.com - Sass vs. LESS vs. Stylus: Preprocessor Shootout
html.html - less.less

Why is my host name wrong at the Terminal prompt when connected to a public WiFi network?
Result successful: Last login: Tue Jan 10 22:55:47 on ttys000
feroniba_macbook_pro:~ Feroniba$

CountDown Timer using a While loop in C YT
C to HTML
CGI Programming in C Tutorial using Raspberry PI with Linux
World Wide Web CGI (Common Gateway Interface) Programming in C

Free software for freedom, surveillance and you - Jacob Appelbaum 11.12.2016 Germany
How Dash Charge Works ft. Emily Ratajkowski



Vocabulary

: - colon - Doppelpunkt
brevity - Kürze - C Preface
formalize - formalisieren, offiziell machen - C Preface
retain - behalten, sichern, beibehalten ... - C Preface
submit - einreichen, vorlegen, überreichen, unterbreiten ...
unambiguous - unzweideutig, eindeutig, unmissverständlich, widerspruchsfrei, eindeutig, unzweideutig - C Preface




Sessions

• Session 1 • Sun 2016-6-26 0:45- Programming in C - start
• Session 2 • Thu 2017-1-12 23:15-5:35 LR The C Programming Language - alles bisherige rekapitulieren - cont. p13-16 - chapter 1.2 test ♡ - WR Summary 1-6, timer.c, 1.2.2_while_i_smaller_j.c u.a.





         

web counter