C


If you are already more advanced in C consider to start here:



♡ Coding Demo ♡

                              C - Summary & Tutorial

                                    First Links

                                   Linux • tmux • Vim


♡♡♡ ♡ ♡♡♡ Richard Feynman Computer Heuristics Lecture - YT ♡♡♡ ♡ ♡♡♡

♡♡♡ ♡ ♡♡♡ Listen to Play Bach - The Jacgues Loussier Trio ♡♡♡ ♡ ♡♡♡


Recommendation: Before you start learning C, have Ubuntu running on your system, and please at first learn Bash - the Ubuntu terminal :-)

C - Quick Guide - tutorialspoint.com
C Reference Card (ANSI)
C Programming Reference Card
The GNU C Reference Manual
C Books - The top books for learning C programming according to the Hacker News community - hackernewsbooks.com
C Programming/Standard libraries
What was Dennis Ritchie like? - quora.com
Games in C - jonathanwhiting.com
Game Development In C Only. Is it possible? - gamedev.stackexchange.com
SDL WP - libsdl.org
"C" Programming Language: Brian Kernighan - Computerphile - YT - BCPL - WP - B (programming language) - WP - Comparing C to machine language - YT
UNIX: Making Computers Easier To Use -- AT&T Archives film from 1982, Bell Laboratories - YT
Summary of the "C" language - csee.umbc.edu - Computer Science / Electrical Engineering - University of Maryland, Baltimore County • 1000 Hilltop Circle • Baltimore, MD 21250
Programming languages used in most popular websites - WP - Top 3 Programming Languages in 2018. (with my thoughts on each) - first learned Perl, PHP, ActionScript for Flash, didn't help much - ... WP Top 3 Progr. Lang - 10:30 Python general backend - Swift iOS - Java Android - on the side JS HTML CSS - YT
Top 5 Programming Languages to Learn in 2018 to Get a Job Without a College Degree - Python $116,000/y JS $110,000/y Ruby on Rails $74.000/y Swift Java - YT
Is there a better alternative to C for low-level coding? - quora.com
Programming in C - UNIX System Calls and Subroutines using C. - A. D. Marshall 1994-2005
Webdesign - webdesign.lovetheuniverse.com - JavaScript games.lovetheuniverse.com/js.html - IDL Webdesign

SDL2

How and where do I start learning C programming? - quora.com - Creating a Doom-style 3D engine in C - YT ♡♡♡ ♡♡♡ - prender - bisqwit.iki.fi - Simple DirectMedia Layer SDL - written in C - WP - download 2.0 libsdl.org - Installation Debian Ubuntu - '“SDL.h” no such file or directory found' when compiling - stackoverflow.com sudo apt-get install libsdl2-2.0 // installs library systemwide
sudo apt-get install libsdl2-dev // for building programs using SDL - read more about packages
<font size="4" color="pink"> - Font Tag - w3schools.com - Color Names - htmlcolorcodes.com If you really want to be a C coder (I mean REALLY Serious), then you must learn every nitty gritty detail.
To program effectively, only two things are needed:
<1>Practice Relentlessly (You think I’m joking?)
<2>Absolute Determination (Cutting sleep just to write C program - that should be the determination :-)
Using SDL2 in C (and with C++, too) - dev.to
SDL Tutorials - libsdl.org - SDL2 C Tutorials, Examples, Demos and more - acry.github.io - Beginning Game Programming v2.0 - SDL2 Tutorial - lazyfoo.net
Writing 2D Games in C using SDL by Thomas Lively - YT
Game Development with SDL 2.0 (Steam Dev Days 2014) - open source answer to DirectX - YT
C Easily with SDL2 by Stephen Jones - 2e 2014 - p78 - Amazon

OpenGL

WP - opengl.org
How to Install OpenGL on Ubuntu Linux - codebind.com sudo apt-get update
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
create opengl_test.cpp - compile with g++ opengl_test.cpp -o openGlTestApp -lglut -lGLU -lGL // compiling
./openGlTestApp // running app, opening window titled "Hello World!" and showing right-angled triangle
sudo apt install mesa-utils // install for checking OpenGL version
glxinfo | grep "OpenGL version" // checks OpenGL version
//> Output:
//> OpenGL version string: 4.6.0 NVIDIA 390.116
Basic OpenGL - beginners-tutorials 1-8 - opengl-tutorial
Tutorial 1 : Opening a window
GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop - provides simple API for creating windows, contexts and surfaces, receiving input and events - GLFW written in C with native support for Windows, macOS and many Unix-like systems using the X Window System, such as Linux and FreeBSD - glfw.org - download and compile using Cmake - cmake.org - Ubuntu CMake Repository Now Available - kitware.com sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt-get update
sudo apt-get install kitware-archive-keyring
sudo apt-key --keyring /etc/apt/trusted.gpg del C1F34CDD40CD72DA
sudo apt-get install cmake
sudo apt-get install cmake-curses-gui
sudo apt-get install cmake-qt-gui
sudo apt-get install cmake-doc
after checking if you need installations for X11, Wayland (wiki.ubuntu.com - How to install wayland on Ubuntu 16.04 LTS? - askubuntu.com - wayland.freedesktop.org), and OSMesa (), go again Compiling GLFW and continue compiling sudo apt-get install xorg-dev // after having X11 packages installed
sudo apt-get install libwayland-dev // after having Wayland packages installed
sudo apt-get install wayland-protocols
sudo apt-get install extra-cmake-modules
sudo apt-get install libosmesa6-dev // for OSMesa - Mesa (computer graphics)
open.gl - this guide will teach you the basics of using OpenGL to develop modern graphics applications
openglbook.com - learnopengl.com - learncpp.com

* * * * *

Game Development

lokigames.com - Programming Linux Games - by John R. Hall, Loki Software - 1e 2001 - p415 - Amazon
Preface
iii - changed from Windows to Linux - Linux lousy for games, because of developers - toolkits like SDL and OpenAL change this - Loki Software converts major commercial games to Linux - before used SVGALib library, now SDL - wrote this book about all - book for Linux game developers - know about Linux, terminal, editor, files, C - ch4,5,6 and 8 are like references - won't cover 3D, OpenGL already in other books - SDL replaces Glut toolkit (p140) - examples on nostarch.com and lokigames.com - acknowledgements
1 - The Anatomy of a Game
Linus created Linux - now (2001) 10 million users - now capable of 3D graphics, Audio, controller handling, server tasks etc., everything what game development needs - book teaches toolkits and environments for 2 and 3D games for Linux - draw animated graphics on screen, digital sound, set up OpenGL creating fluid 3D graphics - by end of book know how Linux games tick, and how to create own games for Linux - not about game design, 3D graph math, have to learn after this book
Game Genres - many players have strong preferences, need to decide for success - 1 simulation games - ... - 2 first-person shooters FPS ... 3 Real-time strategy games RTS ... - 4 turn-based strategy games TBS ... - 5 role-playing games RPG - depends more on storyline, interaction, and depth, than graphics - Ultima Online uo.com WP good example MMORPG (Windows Linux 1997) - The Complete History of Ultima Online! (MMO Historian) - YT - Richard Garriott (born 1961-7-4) ... - simutronics.com -

windows.h for Linux - ubuntuforums.org - you don't need that for Linux - simply comment out that #include <windows.h> statement
Game Programming in C with the Ncurses Library - viget.com - install and use ncurses.h instead of conio.h - find it after installation in /usr/include/ncurses.h sudo apt-get install libncurses5-dev // downloads ncurses.h to /usr/include/ Ncurses Programming Guide by X. Li - cs.ukzn.ac.za
Tetris - Tetris in C, in 200 lines - stackexchange.com - download Feroniba's tetris.c (after "Game over" not exiting correctly, must restart Terminal window, or ctrl c before "Game over" - will be debugged soon :-), compile with gcc tetris.c -lncurses -o tetris // compiles tetris.c to tetris
./tetris // runs tetris :-)

Snake - nSnake: Play The Classic Snake Game In Linux Terminal - itsfoss.com sudo apt-get install nsnake // installs nsnake
nsnake // runs nsnake
Top 10 Command Line Games For Linux - itsfoss.com sudo apt install bastet
bastet // runs bastet
Paint programs - Paint programs for Linux - sourceforge.net - Tux Paint - tuxpaint.org - How to install Tux Paint on Ubuntu 18.04 - linuxhelp.com - install and open from Activities, entering tux wget http://security.ubuntu.com/ubuntu/pool/universe/t/tuxpaint/tuxpaint\_0.9.22-12\_amd64.deb
sudo apt-get install gdebi -y
sudo gdebi tuxpaint\_0.9.22-12\_amd64.deb
Paint-in-C - GitHub
Paint program in C - programmingsimplified.com - paint.c
C graphics programs - programmingsimplified.com - shapes.c


* * * * *

11 Animated Websites, for Design Inspiration - practicalecommerce.com
prismjs.com - syntax highlighter
hilite.me - convert your code snippets into pretty-printed HTML format with numbered lines
HTML5 Code Element With Line Numbers And Text Coloring? - dreamincode.net - alexgorbatchev.com/SyntaxHighlighter

Why is /usr/include missing? I have Xcode and Command Line Tools installed (Mojave) - stackexchange.com
Missing /usr/include in OS X El Capitan - now missing in OS 10.14 Mojave - update Xcode - xcode-select --install already installed installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / didn't help - next:
The compilers know already to find their includes inside the SDK, so there's no real need for the /usr/include directory any more. You can find the SDK's install directory for the include files using xcrun --show-sdk-path cxcrun --show-sdk-path
//> /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include

1
print "Hello world!"




Content

C Summary & Tutorial
Content
Examples
Teaching Structure
C Elements
CS50
Operating System (OS)
Arduino
Energy
Programming Basics
C First Steps
Header Files and Path
Graphics
GTK
Animation
The C++ Programming Language
AI
First Apps
Canvas
tutorialspoint
clc-wiki.net
21st Century C
The C Programming Language - Chapter 1 A Tutorial Introduction - 2 Types, Operators and Expressions - 3 Control Flow - 4 Functions and Program Structure - 5 Pointers and Arrays - 6 Structures - 7 Input and Output - 8 The UNIX System Interface - Appendix A Reference Manual - B Standard Library - C Summary of Changes
Programming in C
Installations
C The Complete Reference
C Primer Plus
Pointers on C
Expert C Programming
Let Us C
Create Your Own Programming Language
Memory as a Programming Concept in C and C++
C
Testing .c Files
Grundkurs C
Computer Architecture
Algorithms and Data Structures
The Algorithm Design Manual
Discrete Mathematics and Its Applications
How to Prove It
Calculus
Mathematics
Structured Computer Organization
Python
Raspberry Pi
Notes
Links
Vocabulary




Examples

C programs - programmingsimplified.com - use #include <curses.h> or <ncurses.h> in Ubuntu instead of <conio.h> - Why can't I find <conio.h> on Linux? [duplicate] - stackoverfolw.com
How do I use graphics.h in Ubuntu? - askubuntu.com - The SDL_bgi and libXbgi Libraries - sourceforge.net - to be able to use <graphics.h> install libXbgi: downloadsdl_bgi_2.2.4-1_amd64.deb and xbgi_365-1_amd64.deb - on Ubuntu right-click on file Open with Software Install - press button "Install" - download example mandelbrot.c or other from the same website on sourceforge.net - compile it in terminal gcc -o mandelbrot mandelbrot.c /usr/lib64/libXbgi.a -lX11 -lm Logic to check alphabet, digit or special character - codeforwin.org
C Programs - studytonight.com - basic loops numbers arrays pointers recursion ♡♡♡




Teaching Structure


TIOBE Index for September 2018 (Netherlands) - WP
The Different Programming Languages - learneroo.com

• Computer Science (CS) - CS50 2017 - YT - David Malan - WP - TW 27K - cs.harvard.edu
• Computer system (Mac OS X, Linux, Windows, Arduino, Raspberry Pi etc.)
Browser (Google Chrome and other) - shortcutsMac Linux Windows - Mac scroll screen down: space - up: shift+space - default size: command+0
Editor Komodo Edit (or other)
Terminal (or other alternatives - tmux - GNU Screen etc.) - path - no fears - computer expensive, software and hardware can become destroyed - like chemistry water sand air fire etc., dangerous techniques will be explained

Compiler GCC - WP - CC (and/or other)
C (programming language) - WP - additional tutorialspoint.com and other
Hello World in C
HTML CSS JS WA - own WS - social media (TW YT FB etc.) - w3schools.com (and/or other) - server and domain - Filezilla FTP application
GUI GTK or other - window

• C tutorialspoint.com (and/or other) - C - Programming Language - Tutorials Point YT Channel
• The C Programming Language - WP - Amazon Kindle - 2nd Edition (ANSI C) - Brian W. Kernighan, Dennis M. Ritchie - 1988 (1st Edition 1978)
• ANSI C - WP - C89 C90 C95 C99 C11 C18
C++ - WP - Compatibility of C and C++ - WP - Learning C++ if you already know C - isocpp.org
Similarities and relations between other languages and C: JavaScript (JS) C++ C-- {Objective-C Cocoa Swift - by Apple} {C# Visual_Basic - by Microsoft} PHP Java Ruby Perl PHP SQL D R {Go - by Google} (CoffeeScript CoffeeCup HTML CSS Sass or other) etc.

Libraries or frameworks: jquery - underscore.js - backbone.js - angular.js (and other)
Assembly (asm) - WebAssembly (wasm, WA)
• Arduino and Raspberry Pi etc.




C Elements

shortest

• learn to read and write code - learn editor Vim (recommended) or other (not recommended)
compile in terminal gcc file.c - run ./a.out - or compile gcc file.c -o "filename" - run ./"filename" - (install gcc if not installed with sudo apt install gcc, test gcc --version - before have Ubuntu or other Linux distribution running - or learn to install, test and run gcc on Windows, Mac etc., not recommended)
• preprocessor header file #include <stdio.h> etc. - find location or folder of header files and understand path, create and use own header file, understand linker
comment /* */ or //
• main function void main(void){} and other functions
expression - 2 * 3 or "Hello World!\n" - statement ending with semicolon ; - x = 3; or return 0; - arguments separated by comma , - printf has 4 arguments: printf ("The sum of %i and %i is %i\n", value1, value2, sum);
token
type void char int float double const _Bool etc. - type specifier long short unsigned signed and long long - format specifier %i %f %c etc. - backslash character \n \a etc. - type cast operator (float) or (int) etc. - type conversions
operator = == + - * / % etc. - precedence
• forming variable name: start with underscore (_) or letter (lower- or uppercase), followed by any combination of letters, underscores or digits (0-9)
string - printf and scanf - printf ("Hello world!\n"); - int number; scanf ("%i", &number);
• • • will be completed soon

prepare

Summary of the "C" language - Includes the ANSI STD features - Based on: "C The Complete Reference" by Herbert Schildt, McGraw-Hill - "Standard C" by Plauger & Brodie - "American National Standard ANSI X.3.159-1998"

gcc --verson // lists GNU C compiler versionfile name.c
helloworld.c - tokens - comments // /* */ - semicolons terminating statements - whitespace (needed or not)
compile and run in terminal - move in terminal to folder cd (folder name) - gcc helloworld.c - ./a.out
• compile and run in tmux etc.
• timer.c

• window.c
preprocessor #include <header.h> - #include "demo.h" - C preprocessor - WP
path in finder and terminal - Ubuntu hidden files: ctrl+H - Apple hidden files: shift+command+.
4 datatypes: char int float double - specifiers: %d (decimal integer) %i (integer) %u (unsigned i) %f (floating-point number) %c (single character) %s (string) %p (pointer) %% (percent sign) ... - printf - wikibooks.org - C data types -> WP
C syntax -> WP

• identifiers _aZ_09_ - not @$% within - case-sensitive
• 44 keywords

file

file name.c

path

find file using Finder and Terminal, copy paste open write close etc.

comment

/* comment 1 - one line */ /* comment 2 - one line ...
*
* or many lines */
... code ... /* comment 3 - between code */ ... code ...
// comment 4 - only one line to the end of that line
... // comment 5 - can also start after code, but always until end of line

header file

check path - find #include folder at usr/include - creating usr/feroniba/header.h #feroniba not working - create usr/include/header.h - use #include <header.h>
place header.h at root folder of header.c - understand difference between #include <header.h> and #incluce "header.h"

type

refer to extensive system to declare variables or functions of different types: char int float double short long signed unsigned *int etc. (pointer to) enum const extern register static void struct typedef sizeof (object or type name) - WP

variable

name given to storage area to manipulate - each variable has specific type

initialize

type name = value // initialize variable
type name [] = {value1, value2, ...} // initialize array
char name [] = "string" // initialize char string

constant

fixed value that program may not alter - also called literal - types can be integer constant, floating-point constant, character constant, or string literal - also enumeration constants - are treated like variables, exept values can't be modified
integer constants or literals: decimal/int 123, octal 007 (not 89) or hexadecimal 0x09f: unsigned int 40u, long 50l, unsigned long 60ul
floating-point constants or literals: ...
character constants or literals: enclosed in single quotes like 'x', can be stored in variable of char type - character literal can be plain character 'c', escape sequence '\t, or universal character '\u02C0'
string literals or constants: enclosed in double quotes "" - similar to character literals: plain, escape, unversal - can break long line into multiple lines: printf("hell" "o" " " "wor" "ld"); or     printf("hel" "lo "

        "w" "o" "rld\n");
output is same //> hello world
defining constants: 2 ways, using #define preprocessor, or const keyword - using #define: #define identifier value #include <stdio.h>

#define LENGTH 10
#define WIDTH 5
#define NEWLINE '\n'

int main() {
    int area;

    area = LENGTH * WIDTH;
    printf("value of area : %d", area);
    printf("%c", NEWLINE);

    return 0;
}

//> value of area : 50
using const: const type variable = value; #include <stdio.h>

int main() {
    const int LENGTH = 10;
    const int WIDTH = 5;
    const char NEWLINE = '\n';
    int area;

    area = LENGTH * WIDTH;
    printf("value of area : %d", area);
    printf("%c", NEWLINE);

    return 0;
}

//> value of area : 50

string

string ...

operator

arithmetic operators: + - * / % ++ -- etc. - there are about 45 operators
relational operators: == != > < >= <=
logical operators: && || ! (called logical AND OR NOT)
bitwise operators: & | ^ (XOR) --- ... ~ (Ones Complement) << (binary left shift) >> (binary right shift) ...
assignment operators: = += -= *= /= %= <<= >>= &= ^= |= ...
misc operators: sizeof() & (returns address of variable) * (pointer) ?: (conditional expression)
precedence: ...

declaration

declaration ...

statement

also called expression? or instruction - expression x = 3 or i++ or printf(...) becomes a statement when it is followed by a semicolon: x = 3; i++; printf(...); a = 3 / 2 * 5;

function

group of statements that together perform a task - at least one function, which is main() - declaration tells the compiler about a function's name, return type, and parameters or arguments - definition provides the actual body of the function return_type function_name( parameter list ) {
    body of the function
}

return

return value;

scope

scope ...

recursion

recursion ... function using itself

array

data structure that can store fixed-size sequential collection of elements of the same type type arrayName [ arraySize ]; first element is index 0 - last element index is total size -1 #include <stdio.h>

int main()
{
    float balance[6] = {1234.1234, 2.1, 3.123, 4.12345, 52.0, 623.123};

    printf("6.5: ""%.5f\t" "1.2: ""%.2f\t" "2f: ""%f\n", balance[5], balance[0], balance[2]);
    return 0;
}

//> 6.5: 623.12299 1.2: 1234.12 2f: 3.123000

struct

similarly to array, structure is another user defined data type and allows to combine data items of different kinds

union

union

pointer

#include <stdio.h>

int main ()
{
    int var1;
    char var2[10];

    printf("Address of var1 variable: %x\n", &var1 );
    printf("Address of var2 variable: %x\n", &var2 );

    return 0;
}

//> Address of var1 variable: e5201a64
//> Address of var2 variable: e5201a6e
pointer variable declaration: type *var-name;

control-flow

; {} break continue goto label return - if else while for do switch case default
if (expression)
statement1
else // optional
statement2

EOF

end of file - c = getchar() != EOF - Mac: control+D

library .h

ANSI standard libraries: #include
--<assert.h> <ctype.h> --<errno.h> <float.h> <limits.h>
--<locale.h> <math.h> --<setjmp.h> --<signal.h> -<stdarg.h>
--<stddef.h> <stdio.h> <stdlib.h> <string.h> <time.h> = 15 total

<complex.h>99 <fenv.h>99 <inttypes.h>99 <iso646.h>NA1 -<stdalign.h>11
-<stdatomic.h>11 -<stdbool.h>99 <stdint>99 -<stdnoreturn.h>11 <tgmath.h>99
-<threads.h>11 -<uchar.h>11 <wchar.h>NA1 <wctype.h>NA1 --- files = 14 + 15 = 29 total
- = Mac missing (path: usr/include) : <stdalign.h> <stdarg.h> <stdatomic.h> <stdbool.h> <stdnoreturn.h> <threads.h> <uchar.h> = 7 total from 29
-- = C Reference Card (ANSI) missing - 6 total from first 15
C standard library - WP

examplary codes

1 • a+-b
#include <stdio.h>

int main( )
{
    int a, b, c;
    printf ("Enter a number for a\n");
    scanf ("%d", &a);
    printf ("Enter a number for b\n");
    scanf ("%d", &b);
    printf ( "a = %d; b = %d;\n", a, b);
    printf ( "a + b = %d\n", c = a + b);
    printf ( "a - b = %d\n", c = a - b);

    return 0;
}

2 • power #include <stdio.h>
#include <math.h>

int main()
{
int base, exp, res;

printf("What is the result of the base raised to the power of it's exponent?\n");
printf("Enter a base: ");
scanf("%d", &base);
printf("The base is %d\n", base);
printf("Enter an exponent: ");
scanf( "%d", &exp);
printf("The exponent is %d\n", exp);
res = pow(base, exp); // pow is a function in math.h
printf ("The base %d raised to the power of the exponent %d yields: %d\n", base, exp, res);

return 0;
}




CS50

CS50 2017 - Lecture 1 - C - David Malan - helloworld.c - for int i = 0; i < 4; i++; 22:20 compile: clang helloworld.c - 27:00 clang -o helloworld hello.c - 28:30 ls (list) and cd (change directory) - create folder fo - cd fo - .. (back to parent folder) or delete folder with rmdir fo - mkdir fo creates folder - 35:00 get_char get_double get_float get_int get_long_long get_string - get_string and get_int - 39:50 make int compiles all - 3 errors: get_int etc. are not in <stdio.h> - add <cs50.h> - Integer Input: 3 - hello, 3 - 46:45 ints.c - // comment - %i 3 values, therefore 3 placeholders follow - * asterisk - % remainder - floats.c - data types, increase floiting-point after . - 56:50 conditions.c - noswitch.c - = already used for assignment, put value from right to left - whereas == stands for equality - 'Y' single quotes for char single characters, "hello" for multiple characters - 1:02:15 || for or - 1:05:00 switch.c - compiled switch looks like that only because of misinterpretation of editor - decide better design of code or efficiency etc. - 1:10:00 return.c - use variable n for number - change coding into better coding, but not every function can be put above every other function, therefore better give a hint what will come later in the program and write it on top, as a prototype - 1:16:30 we will bump up against some limits as follows: depending on RAM, programs therefore designed for 18 or 32 64 etc. bits - and if more input than RAM what to do? Will overflow and change bits or bytes to 0 or negative or positive etc. - 1:20:00 overflow.c and imprecision.c 1 / 10 = 0.10000023462 etc. - also possible underflow - YT
CS50 2017 - Lecture 2 - C, continued about debugging - 1:34 00011100 pic - we need source code > compiler > machine code - we use clang, or others like gcc etc. - ./a.out runs program like double-clicking the program icon - clang -o hello hello.c --- ./hello --- programming write better clear words instead of characters like x or y etc. - 8:30 compiler has to be linked to function correct: $ clang hello.c -lcs50 - be aware that such problems may occur, just solve them, don't take them too serious - always keep with the logic of C or any language :-) - compile with shortcut make - 10:45 dive now quickly into preprocessing, compiling, assembling, linking - write correct code, then style, then design check50 - style50 - 22:50 Super Mario ???? - for int i = 0; i < 4; i++) print ... - starting from 0 because of habit, comes from binary - could also start from 1 - clean screen (only scrolls up) with control l - 32:00 cause infinite print - control c exits program - 34:00 di while for <= etc. - write comments to remember why you wrote that code in that way - variable scope, means different {} don't share variables, so declare them in global scope, and after that don't re-declare them again, just use them (declaration: int n, usage: n - avoid bad design - print rows and colums with # - eprintf, can show how program works - red dots left in cs50 editor pauses computer at that line, use debug50 - 56:30 about cryptography - data types, printf uses %s for string, %i for integer, %f float, %lld long-long-number, %c character etc., check the manual or documentation for these and other :-) - type $ man get_string etc. - 59:00 more at CS50 Reference - 1:00:00 string Stelios - s([i]) - work with strings and numbers, strlen string-length - 1:08:00 ascii0.c converting strings to numbers etc. - ASCII numbers for capital and lower case letters etc. - capitalize0.c - much about strings and numbers :-) 1:17:45 boolean characters true false - islower and toupper - computers grid and memory of bytes and their addresses - \0 at the end of each byte shows the end or number of that byte - 1:25:00 while (s[n] != '\0') - all data types have different or same but fixed lengths - after a while need languages like Python of JS to really have dynamism - 1:28:00 arrays to store, differenciate and manage a group of students etc. - alternative to int main is - argv and argc (argument vector and character) - int main(int argc, string argv[]) - 1:30:00 listen again - YT
CS50 2017 - Lecture 3 - Algorithms - arrays, print initials 23:00 sorting bubble selection sudo insertion etc. - 48:30 a row of n elements has (n-1) pairs, sorting leaves 2nd time n-2 pairs etc., so bubble sort's algorithm is (n-1) + (n-2) + ... + 1 = n(n-1)/2 = (n2-n)/2 = n2/2 - n/2 - examples with n=1,000,000 etc. - 52:30 approximation is "the order of n2", written as O(n2) called big O notation --- O(n log n) --- O(n) linear search --- O(log n) binary search --- O(1) --- 55:50 Ω for lower steps of search 59:00 animation of bubble sort, biggest to smallest from right to left 1:01:00 reverse is selection sort, smallest to biggest - insertion sort - merge sort - 1:04 sort in c - recursion, is a function which shall solve a function with same function inside - YT
CS50 2017 - Lecture 4 - Memory - Swap 11:45 memory structure - YT




Operating System (OS)

3 years of Computer Science in 8 minutes - YT - DIY Air Conditioner (Arduino) - watch the following videos too - YT - Hardest Computer Science Course Explained | Angel of Death UoG - YT - devoncrawford.io

Operating system - WP - Microsoft Windows 82.74%, macOS 13.23%, Linux 1.57% - mobile smartphones and tablets Google's Android 87.5% (increase 10.3/year), iOS 12.1% (decrease 5.2%/year), other 0.3%
Virtual machine (VM) - an efficient, isolated duplicate of a real computer machine, currently used with no direct correspondence to any real hardware - the physical, "real-world" hardware running the VM is generally referred to as the 'host', and the virtual machine (VM) emulated on that machine is generally referred to as the 'guest' - host can emulate several guests, each of which can emulate different operating systems and hardware platforms - WP
Unix filesystem - WP - The UNIX Operating System - PDF
The Unix Programming Environment (Prentice-Hall Software Series) - 1st edition (November 11, 1983) by Brian W. Kernighan - 376 pages - Amazon
The Design of the UNIX Operating System - 1st Edition (June 6, 1986) by Maurice J. Bach - 471 pages - Classic description of the internal algorithms and the structures that form the basis of the UNIX operating system and their relationship to programmer interface. The leading selling UNIX internals book on the market - Amazon
Unix vs Linux - YT




Arduino

Welcome and start learning Arduino at our website ♡

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

Raspberry Pi or Arduino Uno? One Simple Rule to Choose the Right Board - makezine.com




Energy

This Teenager Will Revolutionize Nuclear Power | Archives | NBC News - YT
Taylor Wilson: My radical plan for small nuclear fission reactors - YT
Taylor Wilson: My radical plan for small nuclear fission reactors - 9:00 carbon-free electricity against global warming - YT
The Future of Energy | Taylor Wilson | TEDxUniversityofNevada - carbon and effects on GW - 16:00 get out of the problems technology created: GW, no water, feed 7 billion people etc. - YT
Why Genius Doesn't Matter | Taylor Wilson on Impact Theory - learned from internet self mined uranium smashed nuclear together temperature 40x greater than core of sun, combining at least 20 fundamental fields of science and engineering (physics, chemistry, radiation, meteorology, electrical engineering ...) - 6:30 was incredibly cautious 12:30 curiosity is the key 22:00 optimism because we are intelligent 36:00 N free choice and passion 39:00 nothing is impossible - Elon Musk - YT
The Boy Who Played with Fusion: Extreme Science, Extreme Parenting, and How to Make a Star – June 14, 2016 by Tom Clynes - Amazon
Taylor Wilson - WP - sciradioactive.com

ID: First learn all easy to learn lessons in C, then learn the more complicated concepts numerated in a specific order




Programming Basics

Computer Systems: A Programmer's Perspective - 3/E (CS:APP3e) Randal E. Bryant and David R. O'Hallaron, Carnegie Mellon University - Amazon - Introducing Computer Systems from a Programmer’s Perspective
programmingbasics.org - using JS - created by Dr. Ming-Yee Iu
code.org - founder and CEO Hadi Partovi - Masters degree in computer science from Harvard University - 2013 Hadi and his twin brother Ali launched the education nonprofit Code.org - established computer science classes reaching 25% of US students - launched the global Hour of Code movement that has reached over 100 million students spanning every country in the world - TW 23K - Ali and Hadi Partovi on 'Bloomberg Studio 1.0' - bloomberg.com - What Most Schools Don't Teach - 4:00 Hadi - 4:50 the computer programmers of tomorrow are the wizards of the future - you will look like you have magic powers compared to everybody else - closest thing we have compared to superpowers - YT - “Learning to Code is Not Just for Coders” | Ali Partovi | TEDxSausalito - 4:00 learn computer science instead of how to code 4:30 math and cs 6:00 code.org created complete curriculum for cs beginning in kindergarten - YT - Ali and Hadi Partovi on Being an Immigrant in the Age of President Trump - dad physicist - YT - Code.org - WP - Nowruz Challenge To #LiveTogether - YT

Magician DISSAPEARING Trick WOWS Penn And Teller on Fool Us (Best Magic) - YT
He Came Back After 17 Years to Prove Them WRONG! Simon's APOLOGY? *NEVER GIVE UP MOMENT* - YT




C First Steps

1 • Learn to use Terminal (Shell or Bash) on Mac ( Terminal Cheatsheet for Mac (Basics) - An A-Z Index of the Apple macOS command line (OS X)), Windows, Linux etc. - we will use only Mac in this tutorial (, later also Linux and Windows) -
ctrl+C - escape or exit (leave) the running terminal activity or program
ctrl+U - cut line backwards
ctrl+L - clear screen
ctrl+A - beginning of line
ctrl+E - end of line
ctrl+D - exit shell or send EOF (end of file)
ctrl+_ - (Shift underscore) undo last command
cd - or: cd~ - (change directory) Home directory (~ by option+N)
cd [folder] - change directory to folder
- 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 9.1.0 (clang-902.0.39.2)
//> Target: x86_64-apple-darwin17.6.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 also just check your C version: $ cc -v

OS X 10.14 Mojave: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun Git is not working after macOS Mojave Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) - stackoverflow.com xcode-select --install

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 tutorialspoint.com or 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
- WP
//> Homebrew 1.6.7
//> Homebrew/homebrew-core (git revision c207e2; last commit 2018-06-11)
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 and countdown_timer.c - compile and run in terminal and online (tutorialspoint.com or codechef.com/ide etc. - in codechef.com you have to enter the requested number before you run it - and unfortunately tutorialpoint.com has no input option and prints out 0 instead - you may search for another online app :-)

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) = 44 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.
UNIX: Making Computers Easier To Use -- AT&T Archives film from 1982, Bell Laboratories - YT

8 • Install tmux (spell timux) (if Homebrew already installed) $ brew install tmux start tmux $ tmux quit tmux $ exit


Draper Prize Winner 2018: Bjarne Stroustrup - YT - WP
Bjarne Stroustrup: C++ Today May 2016, C++14 - YT
isocpp.org
C vs. C++
HTML Cheatsheet




Header Files and Path

Where Does GCC Look to Find its Header Files? - commandlinefanatic.com
How to set Gtk include path on a Mac build? - narkive.com
GTK is installed using brew, so it lives in /usr/local/Cellar/gtk+/2.24.22/include/gtk-2.0 Check version: pkg-config --modversion gtk+-2.0 // or gtk+-3.0 brew upgrade pkg-config // or "brew install pkg-config" if not existing
//> shows path: /usr/local/Cellar/pkg-config/0.29.2: 11 files, 627.2KB
brew list
What libraries are there for GUI programming with C and C++ for UNIX systems (including Mac)? - quora.com - on MacOS you must link your project to Quartz GTK+ backend
The GTK+ Project - gtk.org
gtk/gtk.h file not found on Mac - stackoverflow.com gcc gui.c -o gui pkg-config gtk+-2.0 --cflags pkg-config gtk+-2.0 --libs
MacOSX/Quartz - gnucash.org
Using GTK+ on Mac OS X - gnome.org
Gtk2Hs/Mac - haskell.org
Open demo gtk+ = gtk+2: gtk-demo // path: $ /usr/local/Cellar/gtk+/2.24.32_2/bin/gtk3-demo ♡♡♡ ♡ ♡♡♡ - and demos gtk+3 /usr/local/Cellar/gtk+3/3.22.30/bin/gtk3-demo
/usr/local/Cellar/gtk+3/3.22.30/bin/gtk3-demo-application
copy 3 folders: gtk and gdk and unix-print from last path 3.22.30/include/... into mac/usr/include
find glib.h - create file glib.h - put into mac/usr/include
glibconfig.h ...
xcode exec file - YT
How to edit OS X system files with TextEdit - cnet.com
Mac show hidden files - Apple’s keyboard shortcut to show hidden files - applehelpwriter.com - shortcut: shift+command+.
make a copy of gtk3-demo and call it gtk3-demo-test or other as you like - right-click > Get Info - change "Sharing & Permissions: Privilege - Read & Write - open gtk3-demo-test now with Komodo Edit or an editor of your choice - line 728 to 923 (you may have another version of gtk3-demo, find your numbers of your starting and ending lines) starts a c_language_code with
#include <gtk/gtk.h> // - and ends with ...
    return window
}

again starting line 947 to 1273 - 1313 to 1453 - etc., up to last line 30277, always separated by some other codes - I guess Assembly asm and maybe others, too (don't know it yet) - try to understand Pixbufs line 1468 to 1684 ♡♡♡

CSS-TRICKS




Graphics

Computer Graphics: Principles and Practice: Principles and Practices - by John F. Hughes, Morgan McGuire, Andries Van Dam - 3e 2013 - p1264 - Amazon - WP - New Edition of Computer Graphics: Principles and Practice - blog.cs.brown.edu




GTK

Gimp for Mac - download

GTK+ - WP - Quartz (graphics layer) - WP - Integration - gnome.org - Building, Bundling, and Integrating - gnome.org - Building GTK-OSX - gnome.org - first download gtk-osx-build-setup.sh and save it to home-directory - then do sh gtk-osx-build-setup.sh Permission denied - ./install-sh: Permission denied - macports.org sudo chmod 755 ./gtk-osx-build-setup.sh Then repeat sh gtk-osx-build-setup.sh What is GTK+, and how can I use it? - gtk.org
Gtk Mac Integration - brewformulas.org brew install gtk-mac-integration GTK+ 3 Reference Manual - developer.gnome.org
Creating a C/C++ GUI with GTK+ - codeguru.com ->
First: Install gtk+3 on Mac with Brew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null brew install gtk+3 Can't build files: "fatal error: 'gtk/gtk.h' file not found" - github.com
Creating a GUI using gtk in c++ [macos] - reddit.com
How to install gtk on OSX for use with g++/gcc compiler - stackoverflow.com
How to install latest GTK for creating C programs - askubuntu.com
Building GTK-OSX - wiki.gnome.org
check the gtk+-3.0 version here, and put the right version - then: #include <gtk/gtk.h>

static int counter = 0;

void greet( GtkWidget *widget, gpointer data )
{
    // printf equivalent in GTK+
    g_print ("Hi there! Welcome to GTK\n");
    g_print ("%s clicked %d times\n",
        (char*)data, ++counter);
}

void destroy( GtkWidget *widget,gpointer data )
{
    gtk_main_quit ();
}

int main( int argc,char *argv[] )
{

    GtkWidget *window;
    GtkWidget *button;
    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    g_signal_connect (window, "destroy",
    G_CALLBACK (destroy), NULL);
    /* Let's set the border width of the window to 20.
    * You may play with the value and see the
    * difference. */
    gtk_container_set_border_width
        (GTK_CONTAINER (window), 20);

    button = gtk_button_new_with_label ("Click Me!");

    g_signal_connect (GTK_OBJECT(button),
        "clicked",G_CALLBACK (greet),
        "button");

    gtk_container_add (GTK_CONTAINER (window), button);

    gtk_widget_show_all(window);

    gtk_main ();

    return 0;
}
C library function - rand() #include <stdio.h>
#include <stdlib.h>

int main () {
    int i, n;
    time_t t;

    n = 5;

    /* Intializes random number generator */
    srand((unsigned) time(&t));

    /* Print 5 random numbers from 0 to 49 */
    for( i = 0 ; i < n ; i++ ) {
        printf("%d\n", rand() % 50);
    }

    return(0);
}




Animation

Minetest | Free Minecraft Like Open Source Game | Download | Servers | Mods | Showcase Review - YT - minetest.net - WP - Open World Spiel - WP
Install minetest on Mac with Brew - install XQuartz-2.7.11 or newer - then brew install minetest If you would like to start the Minetest server from a terminal, run "/Applications/minetest.app/Contents/MacOS/minetest --server".
[macOS] Neoascetic's nightly builds and others
How to Download and Install Minetest! by Eli-BOT - YT
Tutorial - download Zip - wiki.minetest.net
Getting Started wiki.minetest.net
10 open source alternatives to Minecraft - opensource.com

Irrlicht (Engine) - WP - irrlicht.sourceforge.net - My 3d application with Irrlicht
What are the best 100% free and easy game engines for beginners? - slant.co

Minecraft - WP
Game Development In C Only. Is it possible? - gamedev.stackexchange.com

Unreal Engine 4 vs Unity Showcase - Battle Of The Giants! - YT
Blender Beginner Modelling Tutorial - Part 1 - YTBruce Willis timelapse, made with Blender - YT
5 Amazing 3D Printers You NEED To See In 2018 - YT




JS

JavaScript games.lovetheuniverse.com
How to fix the web | Brendan Eich | TEDxVienna Malwaretisement - YT



The C++ Programming Language

The C++ Programming Language - WP - Amazon Kindle - 4th Edition
Programming: Principles and Practice Using C++ (2nd Edition) 2nd Edition - Amazon Kindle
The Standard - isocpp.org
Bjarne Stroustrup - The Essence of C++ 8:30 peoplethink they can learn a computer language immediately - false, takes about 10 years from inception to serious industrial use, then more decades for everything to get done 13:00 code for spaceship 17:30 need something more fit for humans - Fortran directed focus from machine to problem 20:00 Simula classes oop 22:00 C++ in 2 lines - YT
Why C and C++ are Awful Programming Languages - radford.edu --> SICP

SICP

Structure and Interpretation of Computer Programs - WP - Amazon
Gerald Jay Sussman - WP - Scheme (programming language) - WP
If not SICP, then what? Maybe HTDP? -
Is the book “Structure and Interpretation of Computer Programs” a good read for Java programmers? - you can't be a real programmer unless you know Cantor's work on set theory and Maxwell's equations and are familiar with hole mobility in semiconductors - stackexchange.com




SICP

Structure and Interpretation of Computer Programs
1.1 The Elements of Programming
p6 - ...
p8 - prefix notation (/ 10 5)
;;> 2
nested (+ (* 3 5) (- 10 6))
;;> 19
(+ (* 3 (+ (* 2 4) (+ 3 5))) (+ (- 10 7) 6))
;;> 57
pretty-printing - operandsaligned vertically - indentations display clearly structure of expression (+ (* 3
      (+ (* 2 4)
         (+ 3 5)))
   (+ (- 10 7)
      6))




AI

True Artificial Intelligence will change everything | Juergen Schmidhuber | TEDxLakeComo 10:00 Google buys all AI companies around the world - YT
The Truth Behind Artificial Intelligence | Andrew Zeitler | TEDxStMaryCSSchool - YT
What happens when our computers get smarter than we are? | Nick Bostrom 11:30 where is the off switch to the internet - YT - Nick Bostrom - Could Our Universe Be a Fake? 1:20 3 possibilities: 1 extinct before technologically mature 2 not running simulations about historical predecessors - 3 accept we are simulation in a more advanced intelligent system - YT - Could Our Universe Be a Fake? - Nick Bostrom - WP
Elon Musk Warns About Coming World War 3 And Dark Age (2018) - 6:30 danger of AI much greater than nuclear war - YT
AlphaGo - WP - AlphaGo Official Trailer - YT - AlphaZero - WP - DeepMind - WP - deepmind.com
Scary Artificial Intelligence Breakthrough - What You're About to See will Shock You - YT
5 CREEPIEST Things Done By Artificial Intelligence Robots... - YT
Humanoid Robot Sophia - Almost Human Or PR Stunt 4:00 3 systems: timeline editor, sophisticated chat system, opencog - YT
Humanoid Robot Tells Jokes on GMB! | Good Morning Britain - YT
My Greatest Weakness is Curiosity | Sophia the Robot at Brain Bar - YT
The Dangers of Artificial Intelligence - Robot Sophia makes fun of Elon Musk - A.I. 2018 - YT
Sophia The Robot Is Alive Now? - YT
Sophia Robot Sings at Clockenflap Festival ♡♡♡ ♡ ♡♡♡ - YT
Anonymous - This Shocking Footage Should Worry You! (2018-2019) 11:15 godlike superpowers - YT
Google's Deep Mind Explained! - Self Learning A.I. - YT - waitbutwhy.com
THIS MAN DIED DURING SURGERY, MET GOD & ASKED HIM, "WHAT'S THE MEANING OF LIFE?" 9:30 its all about love - Bible, Jesus - YT

ID
Thu 2018-9-27 Auckland 19:15
Simple living with nature - continue living temporary standards leading to destruction - alternative living via spirit and higher ideals together with technology




First Apps

App 1 - Programming (first browser version 0.01 under development - soon also for Windows, Linux and Mac, Android & iPhone)
App 2 - Ship
App 3 - Music
App 4 - Terasof




Canvas

A Programmer's Guide to Canvas
HTML5 Canvas - w3schools.com
Canvas TS

    w3schools.com

This text is displayed if your browser does not support HTML5 Canvas.

:-)




tutorialspoint

C Tutorial - C - Quick Guide
C Programming Tutorial - PDF

2. Environment Setup
p3 - online compiler - hello world - or use editor vim and compiler gcc - .c files - gcc -v -




clc-wiki.net

K&R2_solutions - clc-wiki.net - C tutorial

cd clc-wiki

Ch 1 - demonstrate.c int demonstrate(void)
{
    return 6;
}

int main(void)
{
    demonstrate();
    return 0;
}
writing first main then demonstrate causes error, because main doesn't know demonstrate yet - works if declaration of demonstrate is made before int demonstrate(void);

int main(void)
{
    demonstrate();
    return 0;
}

int demonstrate(void)
{
    return 6;
}




21st Century C

2nd Edition - © September 2014 O'Reilly - Amazon - 21st Century C - YT - Code Examples - GitHub - TW 0.5K
modelingwithdata.org - sample code and data download
Ben Klemens - WP - ben.klemens.org - On Stealing Ideas (2014-03-30) - Vimeo
sample code and data download
Code Craft - Amazon - Becoming a Better Programmer - Amazon - by Pete Goodliffe

Content

Preface - ix
Part I. The Environment
1 - Set Yourself Up for Easy Compilation - 1
2 - Debug, Test, Document - 31
3 - Packaging Your Project - 65
4 - Version Control - 93
5 - Playing Nice with Others - 107
Part II. The Language
6 - Your Pal the Pointer - 123
7 - Inessential C Syntax that Textbooks Spend a Lot of Time Covering - 141
8 - Important C Syntax that Textbooks Often Do Not Cover - 161
9 - Easier Text Handling - 185
10 - Better Structures - 205
11 - Object-Oriented Programming in C - 245
12 - Parallel Threads - 289
13 - Libraries - 321
Epilogue - 341
A. C101 - 343
Glossary - 363
References - 367
Index - 371
About the Author - 382 - end of book

Appendix A - C 101
p343 - create hello.c - compile with make hello - run ./hello - worked with Ubuntu 18.10 ♡ - more about Using Makefiles p15 - flag -Wall to get warnings listed - alias in POSIX - crun - standard library - preprocessor - after preprocessor almost everything in file will be declaration of variable or type, or definition of function
p346 - 2 types of comments, multiline /* */ or single-line // - 6 elements for printf used in this book: \n newline, \t tab, %i insert integer value here, %g insert real number, %s insert string, %% insert plain percent sign - ... - Basic types ... p348




Practical C Programming

by Steve Oualline - 3e 1997 - p456 - Amazon




The C Programming Language

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


The Practice of Programming by Brian W. Kernighan - 1e 1999 - p270 - Amazon
The Unix Programming Environment by Brian W. Kernighan - 1e 1983 - p376 - Amazon

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

K&R2_solutions - clc-wiki.net
On Learning C - geoff.greer.fm
Is it worth reading The C Programming Language (K&R) and doing all of the examples? - quora.com
Struggling hard with K&R C Programming Language book exercises - reddit.com

Summary

Chapter 1 - A Tutorial Introduction - 9
1 • Hello world - editor - terminal & path - compile with cc hello.c and open with ./a.out or via gcc hello.c -o hello and open with ./hello - #include <stdio.h> - function main() {...} - printf("...\n");
2 • Fahrenheit Celsius - i < j - declare variables before use - datatypes int float char short long double - assignment statement - while - body with single statement no braces needed - different braces, chose - indent 4 -

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 hello.c -o hello --- $ ./hello --- 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) {...} - condition of statements tested, if true: body of loop executed --- 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? Because if i=16 it is smaller than 30, so 16*2=32 is printed
Recommendation: write only one statement per line, and use blanks around operators to clarify grouping - braces different styles possible - use your style consistently - indent statements controlled by while, one tab stop = 4 spaces -

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:
Fahrenheit to Celsius // Exercise 1-3 - Heading

  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

Exercise 1-3. Modify the temperature conversion program to print a heading above the table.
Enter this or other on top of the while loop: printf("Fahrenheit to Celsius\n"); Exercise 1.4. Write a program to print the corresponding Celsius to Fahrenheit table.
If celsius = (5.0/9.0) * (fahr-32.0)
celsius/(5.0/9.0) = fahr-32.0
fahr = (celsius/(5.0/9.0))+32.0
#include <stdio.h>

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

    lower = -20; /* lower limit of temperature scale */
    upper = 160; /* upper limit */
    step = 10; /* step size */

    celsius = lower;

    printf("\nCelsius to Fahrenheit\n\n");

    while (celsius <= upper) {
       fahr = (celsius/(5.0/9.0))+32.0;
       printf("%6.1f %3.0f\n", celsius, fahr);
       celsius = celsius + step;
    }
    printf("\n");
}
works fine :-)

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
Most variables eliminated - fahr is now changed into int fahr - Celsius expression is now third argument of printf - third argument is an instance of a general rule - if value of some type permitted, more complicated expression of that type also can be used - for statement is a loop, a generalization of while - fahr = 0 is done once before loop is entered - then test condition fahr <= 300, if true body of loop executed - then increment step executed, condition revalued - choice between for and while arbitrary - appropriate for loops with initialization and increment as single statements logically related - more compact than while - keeps loop control statements together in one place

Exercise 1-5: Modify the temperature conversion program to print the table in reverse order, that is, from 300 degrees to 0.
Change: for (fahr = 300; fahr >= 0; fahr = fahr-20) - works :-)

1.4 Symbolic Constants

"Magic numbers" like 300 and 20 are bad practice, not clear to someone who reads program, and hard to change in systematic way - one way is give meaningful names - #define line defines symbolic name or constant as particular string of characters: #include <stdio.h>

#define LOWER    0      /* lower limit of table */
#define UPPER    300    /* upper limit */
#define STEP     20     /* step size */

/* print Fahrenheit-Celsius table */
main()
{
   int fahr;

   for (fahr = LOWER; fahr <= UPPER; fahr = fahr + STEP)
      printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32));
}
#define line: symbolic constant names conventionally upper case, so can be distinguished from lower case names - no semicolon at end of #define line - and no = sign

1.5 Character Input and Output

many programs are just expanded versions of following prototypes:
text is only in/out stream of characters, divided into lines followed by \n - stdlib/stdio does it - offers several functions for reading or writing character at a time - getchar and putchar are the simplest - putchar prints character like printf, may be interleaved

1.5.1 File Copying

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();
   }
}
Character on keyboard or screen stored internally as bit pattern - type char meant for storing character data, but any int can also be used - we use int because of distinguishing end of input from valid data - can't use char since c must be big enough to hold EOF in addition to any possible char
...

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);
}
...
parantheses because of precedence of != is higher than =
Exercsise 1-6. Verify that the expression getchar() != EOF is 0 or 1. Solution by Ely Elyasin - GitHub
#include <stdio.h>

int main() {
    int c = getchar();
    printf("getchar() != EOF? %d\n", c != EOF);
}
Exercise 1-7. Write a program to print the value of EOF. Solution by Ely Elyasin - GitHub
#include <stdio.h>

int main() {
    printf("%d\n", EOF);
}
...
output: -1 - must be wrong :-(

1.5.2 Character Counting

#include <stdio.h>

/* count characters in input; 1st version */
int main()
{
    long nc;

    nc = 0;
    while (getchar() != EOF)
        ++nc;
    printf("%ld\n", nc);
}
Problem: must learn how to generate the EOF character (for Mac) in interactive mode - it seems: after pressing enter/return press control+D - the amount of enter/return signs are added, too ... - FO: start 1.5.2_char_count, input your symbols, if you press enter/return it counts 1 extra - at the end must at least once press enter - then press control+D, it counts all input symbols + amount of enter/returns --- not shure ...
new operator ++ increment by one - can write nc = nc +1 but ++nc more concise and efficient - corresponding operator -- - prefix or postfix, ++nc or nc++ -> Chapter 2 - long variable instead of int at least 32 bit, int may overflow - %ld for long integer - double even bigger - for instead of while
...

1.5.3 Line Counting

#include <stdio.h>

/* count lines in input */
int main()
{
    int c, nl;

    nl = 0;
    while ((c = getchar()) != EOF)
        if (c == '\n')
            ++nl;
    printf("%d\n", nl);
}
...

1.5.4 Word Counting

if - else/else if - or || and && ==
...
#include <stdio.h>

#define IN 1 /* inside a word */
#define OUT 0 /* outside a word */

/* count lines, words, and characters in input */
int main()
{
    int c, nl, nw, nc, state;

    state = OUT;
    nl = nw = nc = 0;
    while ((c = getchar()) != EOF) {
        ++nc;
        if (c == '\n')
            ++nl;
        if (c == ' ' || c == '\n' || c == '\t') // correction c == '\t'
            state = OUT;
        else if (state == OUT) {
            state = IN;
            ++nw;
        }
    }
    printf("%d %d %d\n", nl, nw, nc);
}
end terminal with ctrl+D and get output: nl (new line) nw (new word) nc (new character) added in numbers - Mac shows one char more - why?

1.6 Arrays

R ...
#include <stdio.h>

/* count digits, white space, others */
int main()
{
    int c, i, nwhite, nother;
    int ndigit[10];

    nwhite = nother = 0;
    for (i = 0; i < 10; ++i)
        ndigit[i] = 0;

    while ((c = getchar()) != EOF)
        if (c >= '0' && c <= '9')
            ++ndigit[c-'0'];
        else if (c == ' ' || c == '\n' || c == '\t')
            ++nwhite;
        else
            ++nother;

    printf("digits =");
    for (i = 0; i < 10; ++i)
        printf(" %d", ndigit[i]);
    printf(", white space = %d, other = %d\n",
        nwhite, nother);
}
output of this program on itself is: digits = 9 3 0 0 0 0 0 0 0 1, white space = 123, other = 345
Mac terminal shows: digits = 9 3 0 0 0 0 0 0 0 1, white space = 211, other = 348 - why?


1.7 Functions

p25 - functions equivalent to subroutine/function in Fortran, or procedure/function in Pascal - encapsulates cumputation for easy use, only knowing what is done, not how - sue (Nutzung von) functions easy, convinient and efficient - already used provided functions like printf, getchar and putchar - now write our own
C no exponentiation operator like ** Fortran - we illustrate machanics of function definition by power(m,n) - power(2,5) is 32 - function only positive powers of small numbers - stlib contains therfore pow(x,y) for xy -

...
1.7_n-th_power.c #include <stdio.h>

int power(int m, int n);

/* test power function */
main()
{
    int i;
    for (i = 0; i < 10; ++i)
        printf("%d %d %d\n", i, power(2,i), power(-3,i));
    return 0;
}

/* power: raise base to n-th power; n >= 0 */
int power(int base, int n)
{
    int i, p;

    p = 1;
    for (i = 1; i <= n; ++i)
        p = p * base;
    return p;
}

A function definition has this form: return-type function-name(parameter declarations, if any)
{
    declarations
    statements
}
here are 2 independent functions: main(){} and int power(){} - names inside a function are local and not visible to any other function, i in power is unrelated to the i in main - return 0 statement implies normal termination - will use it from now on - int power(int base, int n); before main expects two int arguments and returns an int - is called function prototype and has to agree with definition of power, or it will be an error - names in prototype are optional, could also write int power(int, int); - ANSI C changed how functions are declared and defined - in old definition of C power would be defined different: ...? Old style still works in ANSO C, at least for a transition period, but strongly recommended using new form
Exercise 1.15. Rewrite the temperature conversion program of Section 1.2 to use a function for conversion.

1.8 Arguments - Call by Value

p 28 - ... -
/* power: raise base to n-th power; n >= 0; version 2 - (above this write like in 1.7) */
int power(int base, int n)
{
    int p;

    for (p = 1; n > 0; --n)
        p = p * base;
    return p;
}
...

1.9 Character Arrays

p29 - ... print longest line ... getline returns EOF, more useful would be lenth of line or 0 if EOF - 0 acceptable as EOF because never valid line length - every text line at least one character, only /n has also already lenth 1 - longer line must be saved somewhere, so need second function: copy - so need main program to control getline and copy #include <stdio.h>
#define MAXLINE 1000 /* maximum input line length */

int mgetline(char line[], int maxline); /* changed into mgetline instead of getline - why not MAXLINE? */
void copy(char to[], char from[]);

/* print the longest input line */
int main()
{
    int len; /* current line length */
    int max; /* maximum length seen so far */
    char line[MAXLINE]; /* current input line */
    char longest[MAXLINE]; /* longest line saved here */

    max = 0;
    while ((len = mgetline(line, MAXLINE)) > 0) /* 2nd mgetline changed */
        if (len > max) {
            max = len;
            copy(longest, line);
        }
    if (max > 0) /* there was a line */
        printf("%s", longest);
    return 0;
}

/* mgetline: read a line into s, return length */ /* 4th mgetline in comment changed */
int mgetline(char s[],int lim) /* 3rd mgetline changed */
{
    int c, i;

    for (i=0; i < lim-1 && (c=getchar())!=EOF && c!='\n'; ++i)
        s[i] = c;
    if (c == '\n') {
        s[i] = c;
++i;
    }
    s[i] = '\0';
    return i;
}
/* copy: copy 'from' into 'to'; assume to is big enough */
void copy(char to[], char from[])
{
    int i;

    i = 0;
    while ((to[i] = from[i]) != '\0')
        ++i;
}
3 errors - read stackoverflow.com - enter correction for terminal compilation: gcc -Wall -pedantic -std=c11 "1.9_longest_line.c" -o "1.9_longest_line" Didn't help - again 3 errors - try learntosolveit.com writing 3x mgetline (+ 1x in comment) instead of getline (because of getline definition in stdlib) - compile, run and enter some lines - end with control+D for EOF - works fine, prints the longest line :-)
... R explanation ...
when string like "hello\n" appears in C program, it is stored as an array of characters terminated with '\0' to mark the end - %s format specification in printf expects the corresponding argument to be a string represented in this form - copy also relies on the fact that its input argument is terminated with a '\0', and copies this character into the output
...
Exercises 1-16 to 1-19

1.10 External Variables and Scope

p31 - variables in main, such as line etc., are private or local to main - no other function has access - same in other functions, i in getline is unrelated to i in copy - (chapter 4 discusses static storage class, local var retain values between calls) - automatic variables come and go with function invocation, don't retain values from call to next call, must be set upon each entry, or they'll contain garbage - alternative is defining variables external to all functions, can be accessed by name and function (like Fortran COMMON or Pascal declared outermost block) -
...
rewrite longest-line program with line, longest, and max as external variables - requires changing the calls, declarations, and bodies of all three functions #include <stdio.h>
#define MAXLINE 1000 /* maximum input line size */

int max; /* maximum lenth seen so far */
char line[MAXLINE]; /* current input line */
char longest[MAXLINE]; /* longest line saved here */
int mgetline(void);
void copy(void);

/* print longest input line; specialized version */
int main()
{
    int len; /* current line length */
    extern int max; /* maximum length seen so far */
    extern char longest[]; /* longest line saved here */

    max = 0;
    while ((len = mgetline()) > 0) /* 2nd mgetline changed */
        if (len > max) {
            max = len;
            copy();
        }
    if (max > 0) /* there was a line */
        printf("%s", longest);
    return 0;
}

/* mgetline: specialized version */ /* 4th mgetline in comment changed */
int mgetline(void) /* 3rd mgetline changed */
{
    int c, i;
    extern char line[];

    for (i=0; i < MAXLINE - 1
        && (c = getchar) !=EOF && c != '\n'; ++i) /* K&R print getchar)) --- false */
            line[i] = c;
    if (c == '\n') {
        line[i] = c;
        ++i;
    }
    line[i] = '\0';
    return i;
}

/* copy: specialized version */
void copy(void)
{
    int i;
    extern char line[], longest[];

    i = 0;
    while ((longest[i] = line[i]) != '\0')
        ++i;
}
compiled - run - EOF via control+D not working :-(
...
better word (void) instead of () because standard takes empty list as old-style declaration and turns off all argument list checking - more in chapter 4 - definition refers to place where variable is created or assigned storage - declaration refers to place where the nature of the variable is stated but no storage allocated - be careful with putting everything extern variables - ...
At this point conventional core of C covered - with these building blocks possible to write useful programs - do so
Exercise 1-20 to 1-24

Chapter 2 - Types, Operators and Expressions

p 35 - variables and constants are basic data objects manipulated in program - declarations list var to be used, state type and perhaps initial values - operators specify what to be done to them - expressions combine variables and constants to produce new values - object type determines set of values it can have and what operations can be performed on them - these building blocks topics of chapter
ANSI made small changes to basic types and expressions - now signed and unsigned forms of all integer types, and notations for unsigned constants and hexadecimal character constants - floating-point done in single single precision (long double type for extended precision - string constants may be concatenated at compile time - enumerations became part of language, formalizing feature of long standing - objects may be declared const, prevents them to be changed - rules for automatic coercions among arithmetic types have been augmented to handle richer st of types

2.1 Variable Names

p35 - some restrictions on variable names and symbolic constants - made of letters and digits - first character must be letter - _ underscore counts as letter, improves readability of long names, but don't begin _, because library routines use them - upper/lower case are distinct (x not X etc.) - traditional C practice use lower case for variable names, all upper case for symbolic constants - 31 cahracters of internal name significant - functions and external variables may be less - guarantee of uniqueness only for 6 characters - keywords like if, else, int, float, etc. are reserved, can't use as variable names, must be lower case - wise to choose variable names related to purpose, unlikely to get mixed up - tend using short names for local variables, especially loop indices, longer names for external variables

2.2 Data Types and Sizes

p35 - only few basic data types - char int float (single_prec fl p) double (double-precision floating point) - additional qualifiers short and long: short int sh; long int counter; word int can be omitted: short sh; long counter; - 16 or 32 bit, 2n, n shows bits - signed (- -128 to 127) or unsigned (0 or positive - 0-255) - printable characters always positive - long double extended precision - headers <limits.h> and <float.h> contain symbolic constants for all sizes, along with properties of machine and compiler (Appendix B)

Exercise 2-1

2.3 Constants

...
'x' is not "x" - ... '\0' at the end of a string ...
enum boolean { NO, YES };

enum escapes { BELL = '\a', BACKSPACE = '\b', TAB = '\t', NEWLINE = '\n', VTAB = '\v', RETURN = '\r' };
enum months { JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC }; /* FEB = 2, MAR = 3, etc. */
an alternative to #define, often better ...

2.4 Declarations

p38 - all variables must be declared before use - specifies a type, and contains a list of one or more variables of that type int lower, upper, step; char c, line[1000]; can be distributed among declarations in any fashion int lower; // takes more space, but comment to each declaration possible
int upper;
int step;
char c;
char line[1000];
variable may also be initialized in its declaration - if name is followed by an equals sign and an expression char esc = '\\';
int i=0;
int limit = MAXLINE+1;
float eps = 1.0e-5;
if not automatic variable, initialization done once, and initializer must be a constant expression - automatic variable is initialized each time the function or block it is in is entered, initializer may be any expression - external and static variables are initialized to zero by default - automatic variables without explicit initializer have undefined (garbage) values - the qualifier const can be applied to the declaration of any variable to specify that its value will not be changed, or array elements will not be altered const double e = 2.71828182845905;
const char msg[] = "warning: ";
const declaration can also be used with array arguments, to indicate that the function does not change that array int strlen(const char[]);

2.5 Arithmetic Operators

* / % + - ...

2.6 Relational and Logical Operators

rel op are > >= < <= - all same precedence - below them in precedence are == != - lower precedence than arithmetic operators, so i < lim-1 is taken as i < (lim-1)
... (c=getchar()) != '\n' // parentheses are needed because of precedence, =! higher than = numeric value of relational or logical expression is 1 if relation true, and 0 if false
unary negation operator ! converts a non-zero operand into 0, and a zero operand in 1 - if (!valid) (read: if not valid) rather than if (valid == 0)
Exercise 2-2

2.7 Type Conversions

...

2.8 Increment and Decrement Operators

2.9 Bitwise Operators

2.10 Assignment Operators and Expressions

2.11 Conditional Expressions

2.12 Precedence and Order of Evaluation

...
precedence of the bitwise operators &, ^, and | falls below == and != --- This implies that bit-testing expressions like if ((x & MASK) == 0) ... must be fully parenthesized to give proper results
C, like most languages, does not specify the order in which the operands of an operator are evaluated. (The exceptions are &&, ||, ?:, and `,'.)
...

Chapter 3 - Control Flow

p50 - ...

Chapter 4 - Functions and Program Structure

p59 - ...

Chapter 5 - Pointers and Arrays

p78 - pointer is variable containing address of other variable - partly sometimes only way to express computation, partly lead to more compact and efficient code - pointers and arrays closely related, chapter explores relationship and how to exploit that - ve been lumped with goto statement ... - pointers can be used to achieve clarity and simplicity, as will be illustrated here - type void * replaces char * as proper type for generic pointer
5.1 Pointers and Addresses - ... int x = 1, y = 2, z[10];
int *ip; /* ip is a pointer to int */

ip = &x; /* ip now points to x */
y = *ip; /* y is now 1 */
*ip = 0; /* x is now 0 */
ip = &z[0]; /* ip now points to z[0]

Chapter 6 - Structures

p105 - ...

Chapter 7 - Input and Output

p124 - Input Output not part of C language, therefore not emphasized (hervorgehoben, betont) yet -

Chapter 8 - The UNIX System Interface

p138 - ... - file descriptor returns to program a small non-negative integer, used instead of the name to identify file (analogous to file pointer or file handle of MS-DOS) - when command interpreter (shell) runs program, three files are open, with descriptors 0, 1, and 2, called standard input, standard output, and standard error - if program reads 0 and writes 1 and 2, it can do input and output without worrying about opening files - user can redirect I/O ta and from files with < and > - normally descripter 2 remains atteched to screen to show error messages - similar to pipe - file assignments are changed by shell, not program -


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




Programming in C

Stephen G. Kochan - 4th Edition, August 18, 2014 - 546 pages - Amazon Kindle - GitHub PDF (download, open and export file as PDF, so that you can copy the text parts) - TW 0.4K - ciscopress.com About Stephen G. Kochan - Steve spent several years working at AT&T Bell Laboratories - while he was there, he worked on performance measurement tools and developed and taught courses in C programming and the Unix System
INTERVIEWS by STEPHEN IBARAKI, I.S.P. - World-Renowned, 20-Year Development Expert in C, Unix, Shell Programming, and Authority on Cold Fusion - Book Reviews - goodreads.com - Stuff that should be avoided - iso-9899.info - Review - accu.org
Harvard Book Recommendations - by instructor David Malan - cloudfront.net

C Programming Examples - programiz.com
• HTML, similar to C, has a header and a body ( in C main() function's body is inside of {} ), and uses tags between < and > like the header file in C <stdio.h> - an emty main() function does nothing, but is a valid C program: int main(void) {
}

Content

Contents at a Glance - 9
Table of Contents - 11
Introduction - 23
1 Some Fundamentals - 26
2 Compiling and Running Your First Program - 33
3 Variables, Data Types, and Arithmetic Expressions - 44
4 Program Looping - 67
5 Making Decisions - 92
6 Working with Arrays - 125
7 Working with Functions - 152
8 Working with Structures - 202
9 Character Strings - 235
10 Pointers - 279
11 Operations on Bits - 327
12 The Preprocessor - 349
13 Extending Data Types with the Enumerated Data Type, Type Definitions, and Data Type Conversions - 374
14 Working with Larger Programs - 386
15 Input and Output Operations in C - 401
16 Miscellaneous and Advanced Features - 430
17 Debugging Programs - 448
18 Object-Oriented Programming - 471
A C Language Summary - 486
B The Standard C Library - 535
C Compiling Programs with gcc - 562
D Common Programming Mistakes - 565
E Resources - 570
Index - 576-605
(Codes - 606-1270 end of book) - codes folder online (coming soon)

Introduction

p23 http://www.url.com- 1990 first ANSI C 90 - International Standard Organization (ISO) adopted the standard, ISO/IEC 9899:1990 - ANSI C 99, ISO/IEC 9899:1999 - book 4e based on ANSI C11, or ISO/IEC 9899:2011 - C higher-level language - yet provides capabilities to “get in close” with the hardware and deal with the computer on a much lower level - originally designed with systems programming applications in mind - provides user with an enormous amount of power and flexibility
reading book no previous exposure to the language needed - designed to appeal to novice and experienced programmers alike - every feature of the C language is treated in this text - each new feature is presented with a small complete program example - overriding philosophy of this book: to teach by example - like picture tells more than words well chosen program example does - download and run each program - become familiar with process of typing in, compiling, and running - readability, programs should be written so that they can be easily read—either by the author or by somebody else - read each chapter in succession, highly discouraged from “skipping around” - work through exercises - ch1 fundamentels about higher-level programming - ch2 compiling and running - by the time ch15 will have covered all essential features of C and goes into more depth about I/O operations - ch16 features of more advanced or esoteric nature - ch17 how to use preprocessor for debugging, and interactive debugging - debugger gdb - ch18 oop, C++, C#, and Objective-C - AppendixA complete summary of C - apxB Standard Library routines - apxC gcc - apxD common mistakes - apxE Resources - book makes no assumptions about particular computer system or operating system - only gcc

1 - Some Fundamentals

p26 - these fundamentals must be learned before learning how to program in C - most computers very dumb, only add 1 or check if equal 0 etc. - Richard Feynman Computer Heuristics Lecture - YT - program = collection of necessary instructions (or statements) to solve a specific problem - the method to solve it is called algorithm - example test if number odd or even - first create algorithm: divide by two, if remainder is 0 number is even, otherwise odd - now write instructions (or statements) necessary implementing algorithm on particular computer system in particular language like Java, C++, Objective-C, or C
Higher-Level-Languages - first computers programmed only binary 0/1 corresponding directly to machine instructions and memory locations - next advantage development of assembly languages, slightly higher level, using symbolic names performing operations and refering to memory locations - assembler translated into machine instructions - because of one-to-one correspondence regarded as low-level - programmer must still learn instruction set of computer system to write in assembly, resulting program not portable unless being rewritten - different processor types have different instruction sets, so assembly language programs are machine-dependent
higher-level languages, Fortran (FORmula TRANslation) one of the first - one Fortran instruction or statement resulted in many different machine instructions, other than one-to-one - standardization of syntax could make machine independent - this makes compiler necessary
Operating Systems - p27 - ... - Compiling Programs - figure 1.1 - file name .c - use editor, vim etc. - enter source file in document - compile via entering command, cc or gcc - compiler examines each statement in source code (ch12 preprocessor) - mistakes are reported and compilation ends there - correcting errors in source via editor, restart compilation - most systems source is translated into assembly, needed to perform identical task - next step translating into machine code/instructions or binary code, called object code, written on another file on system, last letter o (for object) instead of c, under Windows obj - now program ready to be linked, performed automatically, like library files .h etc., often called building - final linked file is executable object, stored in other file, under Unix called a.out, Windows exe - execute typing name of executable object file, a.out - each statement executed, may request input from user, or mouse click etc. - results displayed, called output, in a window, sometimes called console, or might be written to a file - if not desired results, debugging phase changing source - repeat compile, link, execute to obtain desired result
Integrated Development Environments - p31 - IDE - OS X Xcode, Windows Microsoft Visual Studio - most IDEs support different languages (more Appendix E)
Language Interpreters - p32 - other method than compiling - interpreter analyzes and executes statements at same time - easier to debug - typically slower because not compiled - other examples include shell and Python - some vendors offer interpreter for C

2 - Compiling and Running Your First Program

p33 - program 3.1 Hello world (Programming is fun.) - int main (void) ... return 0;
lower and upper case distinct - free blank space and tabs
p35 - 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.)
p36 - 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.)
p38 - program 3.4 - int sum; - variables must be declared 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
p39 - 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
p40 - Comments - // or /* */ etc.
p42 - Exercises - 1. - typed and ran all 6 programs
- 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
Code with Online syntax highlighting for the masses! for "C" - Beautify your code - tohtml.com

#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
...

3 - Variables, Data Types, and Arithmetic Expressions

p44 - 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
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 Integer Type int
p45 - 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 like 12,000 - must be 12000
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) // PIC p45 rgb.c

#include

int main(void)
{
    int oct = 127, rgbColor = 0xFF1E0D;

    printf("127 is octal %#o - with leading 0\n", oct);
    printf("88 is octal %o - without leading 0\n\n", oct - 39);

    printf("rgbColor is %#x - lowercase with leading 0x\n", rgbColor);
    printf("rgbColor is %x - lowercase without leading 0x\n", rgbColor);
    printf("rgbColor is %#X - uppercase with leading 0X\n", rgbColor);
    printf("rgbColor is %X - uppercase without leading 0X\n", rgbColor);

    return 0;
}

//> 127 is octal 0177 - with leading 0
//> 88 is octal 130 - without leading 0

//> rgbColor is 0xff1e0d - lowercase with leading 0x
//> rgbColor is ff1e0d - lowercase without leading 0x
//> rgbColor is 0XFF1E0D - uppercase with leading 0X
//> rgbColor is FF1E0D - uppercase without leading 0X
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
p46 - 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 104 (before e called mantissa, after called exponent) - optional +, or - before exponent: 2.25E-3 is 2.25 x 10-3 or 0.0025 - e lower- or uppercase
better use %g, printf decides of display normal or scientific, if less than -4 or greater 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
p47 - 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 // PIC3 p47 char.c

#include

int main(void)
{
    char ch = '$', ch2 = 'A';

    printf("Testing %c", ch);
    printf (" ... %c\n", ch2);

    ch = '%'; ch2 = 'B';

    printf("Testing %c", ch);
    printf (" ... %c\n", ch2);

    return 0;
}

//> Testing $ ... A
//> Testing % ... B
...
The Boolean Data Type _Bool
...
Type Specifiers: long, long long, short, unsigned, and signed
...
Working with Variables
p52 - Early programmers wrote binary language and assigned and referenced storage location memory by number and address - today assigning variable names to store types of variables, like floating-point numbers, characters, pointers - rules for forming: begin with letter or underscore, followed by any combination of letters upper-/lowercase, underscores or digits 0-9 - examples - no reserved words (keywords) - better shorter names only because of writing and reading - first 63 or 31 characters significant - give meaningful names to increase readability - ... -
Working with Arithmetic Expressions
p54 - 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 is associative, means left to right or right to left (more in Appendix A complete list and rules of association)
program 4.2
...
p55 - 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
p57 - ... - Program 3.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
p59 - 25 % 7 = 4 --- printf("%%") // prints % --- remainder of first value divided by second - program 3.4:
// The modulus operator

#include <stdio.h>

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

    printf("a = %i, b = %i, c = %i, and d = %i\n", a, b, c, d);
    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 = 25, b = 5, c = 10, and d = 7
a % b = 0
a % c = 5
a % d = 4
a / d * d + a % d = 25
p 60 - line can be continued to next line at any point at which blank space can be used (exception see chapter 9 "Character Strings") - use indentation - 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
...
The Type Cast Operator
...
Combining Operations with Assignment: The Assignment Operators
...
Types _Complex and _Imaginery
p64 - support since C99, C11 makes it optional - test compiler examining summary of data types appA
Exercises 1-9
p65 -

4 - Program Looping

p67 - repeated calculations with computers, use same code repeatedly - for while do break continue statements
Triangular Numbers
...
general format of for statement: for ( init_expression; loop_condition; loop_expression )
    program statement (or statements)

5 - Making Decisions

pic5.1_absolute_value.c
pic5.2_average_grades.c - pic5.2_average_grades download compiled file
pic5.3_even_odd.c
p98 - if else if ( expression )
    program statement 1
else
    program statement 2
pic5.4_if_else.c

6 - Working with Arrays

p125 - example to read grades into computer and perform operations - defining arrays containing set of grades etc. and reference each element by index number or subscript - in math subscripted variable xi refers to the ith element x in a set - in C notation x[i] - grades[5] (read grades sub 5) refers to element 5 in array called grades - elements begin with number 0 - individual element can be assigned to variable, g = grades[5] - value can be stored in element grades[100] = 95; - sequence through first 100 elements for ( i = 0; i < 100; ++i )
sum += grades[i];
...
pic6.1_array.c
Using Array Elements as Counters
p131 - analyzing 5000 results from 1-10 of television show -

7 - Working with Functions

p152 - Behind every well-written C program functions - breaking down tasks into functions makes code easier to write, read, understand, debug, modify, maintain
Defining a Function - ... - pic7.1_2_functions.c void printMessage (void)
{
    printf ("Programming is fun.\n");

    return; // optional, no value specified }

int main (void)
{
    printMessage ();

    return 0;
}
must always have main() to begin program execution - for printMessage() return; optional possible, no value specified - pic.7.2_repeat_function.c ... pic.7.3_++i_function.c ... - pic7.4_nth_triangular_number.c
Function Prototype Declaration void calculateTriangularNumber (int n) p157 - in this case n is called the "formal parameter name" and can be used after declaration anywhere in function - ...
Automatic Local Variables
p158 - ... - HW rewrite pic4.7 - ...

8 - Working with Structures

p202 -

9 - Character Strings

p235 -

10 - Pointers

p279 - first understand indirection - buy ink via delegation ... #include

int main (void)
{
    char c = 'Q', d = 'R'; // d added by Feroniba
    char *char_pointer = &c;

    printf ("%c %c\n", c, *char_pointer);

    c = '/';
    printf ("%c %c\n", c, *char_pointer);

    *char_pointer = '(';
    printf ("%c %c\n", c, *char_pointer); // c will hold value '(' after char_pointer = &d;

    char_pointer = &d; // added by Feroniba - not *char_pointer = &d;
    printf ("%c %c %c\n", c, d, *char_pointer); // added by Feroniba

    char_pointer = &c; // added by Feroniba - assigned back to c which holds the changed value '('
    printf ("%c %c %c\n", c, d, *char_pointer); // added by Feroniba

    return 0;
}

//> Q Q
//> / /
//> ( (
//> ? R ? // ( R R - this was the expected result from Feroniba's additions, warning message:
//> 17:16: warning: assignment to ‘char’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
//> *char_pointer = &d; // after correcting char_pointer = &d; expected result appears
//>               ^
//> ( R R // result as initially expected :-)
//> ( R ( // result as expected - *char_pointer assigned back to '('
char *char_pointer = &c; could have been expressed in 2 statements: char *char_pointer; char_pointer = &c; but not *char_pointer = &c; - Always remember, that the value of a pointer in C is meaningless until it is set pointing to something - ...
Working with Pointers and Structures
p285 ...

Exercises
...
pic10ex12_printf_set1-4.c

C Programming Pointers - programiz.com #include <stdio.h>

int main()
{
    int var = 5;
    printf("Value: %d\n", var);
    printf("Address: %u\n", &var);
    return 0;
}
Output: Value: 5
Address: 3940846200

C Pointers Explained, Really - karwin.blogspot.com

12 - The Preprocessor

p349 - ... - preprocessor statements identified by pound sign #, must be first nonspace character on line
The #define Statement #define YES 1
#define NO 0
assigns YES to 1 and and NO to 0 and can be used anywhere in program like gameOver = YES; // assigns 1
gameOver = NO; // assigns 0
p350 - can't be used inside of char string like char *charPtr = "YES"; - will not assign 1 - defined name is not a variable - ...
...
The # Operator
...
The ## Operator
...
The #include Statement
...

A - C Language Summary

p486 - C reference, not complete definition of C, but description of features - thoroughly reading reinforces material and provides better global understanding - ANSI C11
1.0 - Digraphs and Identifiers - 1.1 - Digraph Characters - <: :> = [ ] --- <% %> = { } --- %: %:%: = # ##
1.2 - Identifiers - sequence of letters (upper- lowercase), universal character names (\u followed by 4 hexadecimal numbers or \U followed by 8 hex n ...), digits, or underscore characters ...
1.2.1 - Universal Character Names ...
1.2.2 - Keywords - 38 ...
2.0 Comments ...
3.0 Constants - 3.1 Integer Constants - ...
3.2 Floating-Point Constants - ...
3.3 Character Constants - ...
3.3.1 Escape Sequences - special \a \b \f \n \r \t \v \\ \" \' \? \nnn \unnnn \Unnnnnnnn \xnn
3.3.2 Wide Character Constants - L'x' wchar_t defined in <stddef.h> ...
3.4 Character String Constants - sequence of 0 or more characters enclosed within double quotation marks "abc" - any valid character including escape characters - compiler auto-includes '\0' at end of string - ...
3.4.1 Character String Concatenation - prprocessor auto-concatenates adjacent character string constants together, separated by 0 or more whitespace characters - "a" "character" "string" equivalent to "a character string"
3.4.2 Multibyte Character - ...
3.4.3 Wide Character String Constants - L"..." type "pointer to wchar_t" ...
3.5 Enumeration Constants - ...
4.0 Data Types and Declarations - summerizes basic -, derived -, enumerated data types, and typedef - also format for declaring variables
4.1 Declarations - ...
4.2 Basic Data Types - using format type  name = initial_value;
int - short int - long int - long long int - unsigned int - float - double - long double - char - unsigned char - signed char - _Bool - float _Complex - double _Complex - long double _Complex - void
assignment of initial value to variable is optional - more than one variable can be declared at once by general format:
type  name = initial_value, name = initial_value, ... ;
...
4.3 Derived Data Types - built from one or more basic data types: arrays, structures, unions, pointers, and function that returns value of specified type - each of these (except functions) is summarized in following sections - functions separately
4.3.1 Arrays - Single-Dimensional Arrays - ...
4.3.1.1 Variable-Length Arrays - ...
4.3.1.2 Multidimensional Arrays - ...
4.3.2 Structures - ...
4.3.3 Unions - ...
4.3.4 Pointers - ...
4.4 Enumerated Data Types - ...
4.5 The typedef Statement - ...
4.6 Type Modifiers const, volatile, and restrict - ...
5.0 Expressions - Variable names, function names, array names, constants, function calls, array references, and structure and union references are all considered expressions. Applying a unary operator (where appropriate) to one of these expressions is also an expression, as is combining two or more of these expressions with a binary or ternary operator. Finally, an expression enclosed within parentheses is also an expression - ...
5.1 Summary of C Operators - precedence and examples ...
5.2 Constant Expressions - ...
5.3 Arithmetic Operators - + - * / % ...
5.4 Logical Operators - && || ! ...
5.5 Relational Operators - < <:= > >= == != ...
5.6 Bitwise Operators - & | ^ ~ << >> ...
5.7 Increment and Decrement Operators - lvalue lv is modifiable expression, type not qualified as const: ++lv lv++ --lv lv-- ...
5.8 Assignment Operators - lv not const, op assignment operator, a expression: lv = a --- lv op=a ...
5.9 Conditional Operators - a, b, c are expressions: a ? b : c has as its value b if a is nonzero, and c otherwise; only expression b or c is evaluated ...
5.10 Type Cast Operator - ...
5.11 sizeof Operator - ...
5.12 Comma Operator - ...
5.13 Basic Operations with Arrays - ...
5.14 Basic Operations with Structures - ...
5.15 Basic Operations with Pointers - ...
5.16 Compound Literals - ...
5.17 Conversion of Basic Data Types - ...
6.0 Storage Classes and Scope - ...
6.1 Functions - ...
6.2 Variables - ...
7.0 Functions - ...
7.1 Function Definition - ...
7.2 Function Call - ...
7.3 Function Pointers - ...
8.0 Statements - ...
8.1 Compound Statements - ...
8.2 The break Statement - ...
8.3 The continue Statement - ...
8.4 The do Statement - ...
8.5 The for Statement - ...
8.6 The goto Statement - ...
8.7 The if Statement - ...
8.8 The null Statement - ...
8.9 The return Statement - ...
8.10 The switch Statement - ...
8.11 The while Statement - ...
9.0 The Preprocessor - ...
9.1-3 ...

B - The Standard C Library

p534 - ...




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




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


Visual Studio Code (VS Code)

Visual Studio Code (VS Code) - WP - TW 160K - What are the differences between Visual Studio Code and Visual Studio? - stackoverflow.com - Download for Mac
Microsoft Visual Studio - WP

Create an OSX App

Can I create GUI Mac apps without Xcode? And why? - quora.com
Atom (text editor) - WP - atom.io
electronjs.org - Build cross platform desktop apps with JavaScript, HTML, and CSS - A division of atom.io
What is Electron: The Hard Parts Made Easy - Electron is framework to create crossplatform apps - YT
An Intro To Electron - Desktop Apps with JavaScript - 24:09 min - YT
electron-quick-start - GitHub - TW - 25K
Discuss forum - Slack - join with email - today (2018-9-16 5:35 Auckland New Zealand) 111 users online now of 18694 registered
Download electron-api-demos - failed :-(
Creating an OSX application without Xcode - stackoverflow.com

Electron Documentation

Docs / Guides / Writing Your First Electron App

Writing Your First Electron App
Electron uses web pages as its GUI - like a minimal Chromium browser, controlled by JavaScript
Spin up the Quick Start app to see Electron in action:
A minimal Electron app with helpful notations. # Clone the Quick Start repository
$ git clone https://github.com/electron/electron-quick-start

# Go into the repository
$ cd electron-quick-start

# Install the dependencies and run
$ npm install && npm start
Check installed versions: npm -v // should output: 4.0.5 - or other/similar
git --version // should output: git version 2.15.2 (Apple Git-101.1) - or other/similar
To check out the process architecture, see Main and Renderer Processes. - Using Electron APIs - Using Node.js APIs
To learn more about Electron, check out the official guides.

Slack

First app: Feroniba > electron-quick-start > .git (= folder) .gitignore index.html LICENSE.md main.js node_modules (= folder) package-lock.json package.json README.md renderer.js --- did it
did $ npm init
Now install electron itself: run command from my app's directory: npm install --save-dev electron Other means for installing Electron exist. Please consult the installation guide to learn about use with proxies, mirrors, and custom caches. The path is for MacOS: ~/Library/Caches/electron/ --- or in ~/.electron - for more Troubleshooting read document
Once we've created our initial main.js, index.html, and package.json files, we can try our app by running npm start from our application's directory
Now Run App 1 from terminal $ npm start - Yes! Opens App 1 ♡ - Quit app with control-C, or Mac app window red button top left, or command-Q

Now trying this Example:
Clone and run the code in this tutorial by using the electron/electron-quick-start repository.

Note: Running this requires Git and npm.

# Clone the repository
$ git clone https://github.com/electron/electron-quick-start
# Go into the repository
$ cd electron-quick-start
# Install dependencies
$ npm install
# Run the app
$ npm start
For a list of boilerplates and tools to kick-start your development process, see the Boilerplates and CLIs documentation.
An Intro To Electron - Desktop Apps with JavaScript - Electron is open source library for creating cross-platform desktop apps with only HTML, CSS and JS - combines Chromium and Node.js - apps can be packaged for Windows, Mac & Linux - programming is for all platforms exactly the same language - Apps built on Electron: Atom Stack Visual_Studio_Code Wordpress.com Brave_Browser etc. 2:30 main process and renderer process - 3:30 installation 4:30 start building main folder and app - 24:09 min - YT
Electron API Demos - chose your platform, Windows, Mac or Linux, download app -




C The Complete Reference

Amazon - by Herbert Schildt - 4e 2000 - p805 -

1 - An Overview of C
... source code (.c), object code (compiled) p10 keywords - upper- and lowercase different - main(), more functions possible - don't use main, like other keywords, not to confuse compiler - using libraries and writing own libraries - linking source code with library - program can be spred across more files; advantage is that if one file is changed don't need to compile all others again (strategies part 5 of book) - compilation - memory: program code (source file), global variables, heap, stack - C vs C++ - review: sorce code input to compiler, object code input to linker, linker links separate modules and output is executable program, library includes standard functions, compile time, run time

2 - Expressions p18 - most fundamental element of C language: expression - formed from these atomic elements: data and operators - data may be represented by variables, constants, or values returnes by operators - C89 5 foundational data types: char int float double void - char 1 byte - int same as computer's word length, 16 bits, 32 bits, 64 bits etc. - 3 more data types by C99: _Bool _Complex _Imaginary (described in part 2) - ... - modifiers: signed unsigned long short - list of combinations ... - identifier names: first character letter or underscore, subsequent characters letters, digits or underscores like _aBc_123_etc__ - any length allowed - not same as keyword or name of library function - variables must be declared before use, like type variable_list; int i, j, l; short int si; - variables 3 places: inside functions, in definition of function parameters, outside of all functions, called local variables, formal parameters, global variables - outer and inner variables ... C89 and C99 #include <stdio.h>
int count; /* count is global */

void func1(void);
void func2(void);

int main(void)
{
    count = 100;
    func1();

    return 0;
}

void func1(void)
{
    int temp;

    temp = count;
    func2(); // will print ..........
    printf(" count is %d", count); /* will print 100 */
}

void func2(void)
{
    int count;

    for(count=1; count<=10; count++)
        putchar('.');
}
...


3 - Statements
p78 - /* Demonstrate multiple loop control variables. */
#include <stdio.h>
#include <string.h>

void converge(char *targ, char *src);

int main(void)
{
    char target[80] = "X-X-X-X-X-X-X-X-X-X-X-X-X-X-X";
    converge(target, "This is a test of converge().");
    printf("\nFinal string:\n%s\n", target);

    return 0;
}

/* This function copies one string into another.
    It copies characters to both the ends,
    converging at the middle. */
void converge(char *targ, char *src)
{
    int i, j;

    printf("\n%s\n", targ);
    for(i=0, j=strlen(src); i<=j; i++, j--) {
        targ[i] = src[i];
        targ[j] = src[j];
        printf("%s\n", targ);
    }
}

5 - Pointers
p120 - ...
p122 - Pointer Assignments #include <stdio.h>
int main(void)
{
    int x = 99;
    int *p1, *p2;

    p1 = &x;
    p2 = p1;

    /* print the value of x twice */
    printf("Values at p1 and p2: %d %d\n", *p1, *p2);
    /* print the address of x twice */
    printf("Addresses pointed to by p1 and p2: %p %p", p1, p2);
    return 0;
}

//> Values at p1 and p2: 99 99
//> Addresses pointed to by p1 and p2: 0063FDF0 0063FDF0




C Primer Plus

by Stephen Prata - 6e 2014 - p1066 - Amazon
5 Best C Programming Books A C Programmer Must Read - fromdev.com
The C Puzzle Book - Amazon

9 - Functions
...
Pointers: A First Look p371 - pointer is variable or data object, whose value is a memory address ptr = &pooh; // assigns pooh's address to ptr say: ptr points to pooh - ptr is variable or modifiable lvalue, &pooh is constant or rvalue - make ptr point elsewhere ptr = &bah; // make ptr point to bah instead of to pooh now value of ptr is address of bah - to create ponter variable, need to be able to declare type, need new "indirection" or "dereferencing" operator * (not multiplication) - we know ptr points to bah, ptr = &bah; - find value stored in bah val = *ptr; // finding the value ptr points to The statements ptr = &bah; and val = *ptr; taken together amount to the following statement: val = bah; indirect way, therefore called indirection operator - summary: nurse = 22;
ptr = &nurse; // pointer to nurse
val = *ptr; // assigns value at location ptr to val, here 22
Declaring Pointers
because of different amount of storage we need the size, therefore need to declare type to which the variable points int * pi; // pi is a pointer to an integer variable
char * pc; // pc is a pointer to a character variable
float * pf, * pg; // pf, pg are pointers to float variables
space optional, * pi is same as *pi - ... - pointer is a new type, can't multiply pointers like integers etc. - ANSI C provides %p for pointers
Using Pointers to Communicate Between Functions
...

10 - Arrays and Pointers
...




Pointers on C

Introduction to Pointers - C programming #1 - YT - Functions #2 - Application of pointers #3 - Arrays and pointers #4 - ... #6

by Kenneth Reek - Amazon - cs.rit.edu personal website

Content
1 - A Quick Start - p1
2 - Basic Concepts - p25
3 Data - p39
4 - Statements - p71
5 - Operators and Expressions - p93
6 - Pointers - p129
7 - Functions - p165
8 - Arrays - p197
9 - Strings, Characters, and Bytes - p243
10 - Structures and Unions - p269
11 - Dynamic Memory Allocoation - p303
12 - Using Structures and Pointers - p321
13 - Advanced Pointers Topics - p350
14 - The Preprocessor - p383
15 - Input/Output Functions - p409
16 - Standard Library - p453
17 - Classic Abstract Data Types (Stacks) - p493
18 - Runtime Environment - p537
APPENDIX - Selected Problem Solutions - p561-608 - end of book

1.1 Introduction ...
p2 - rearrang.c /*
** This program reads input lines from standard input and prints
** each input line, followed by just some portions of the line, to
** the standard output.
**
** The first input is a lint of column numbers, which ends with a
** negative number. The column numbers are paired and specify
** ranges of columns from the input line that are to be printed.
** For example, 0 3 10 12 -1 indicates that only columns 0 through 3
** and columns 10 through 12 will be printed.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_COLS     20      /* max # of columns to process */
#define MAX_INPUT    1000    /* max len of input & output lines */

int    read_column_numbers( int columns[], int max );
void   rearrange( char *output, char const *input,
             int n_columns, int const columns[] );

int
main( void )
{
    int n_columns;             /* # of columns to process */
    int columns[MAX_COLS];     /* the columns to process */
    char input[MAX_INPUT];     /* array for input line */
    char output[MAX_INPUT];    /* array for output line */

    /*
    ** Read the list of column numbers
    */
    n_columns = read_column_numbers( columns, MAX_COLS );

    /*
    ** Read, process and print the remaining lines of input
    */
    while( gets(input ) != NULL ){
        printf( "Original input : %s\n", input );
        rearrange( output, input, n_columns, columns );
        printf( "Rearranged line: %s\n", output );
    }

    return EXIT_SUCCESS;
}



/*
** Read the list of column numbers, ignoring any beyond the specified
** maximum.
*/
int
read_column_numbers( int columns[], int max )
{
    int num = 0;
    int ch;

    /*
    ** Get the numbers, stopping at eof or when a number is < 0.
    */
    while( num < max && scanf( "%d", &columns[num] ) == 1
        &&columns[num] >= 0 )
        num +=1;

    /*
    ** Make sure we have an even number of inputs, as they are
    ** supposed to be paired.
    */
    if( num % 2 != 0 ){
            puts( "Last column number is not paired." );
            exit( EXIT_FAILURE );
    }

    /*
    ** Discard the rest of the line that contained the final
    ** number.
    */
    while( (ch = getchar()) != EOF && ch != '\n' )
        ;
    return num;
}

/*
** Process a line of input by concatenating the characters from
** the indicated columns. The output line is the NUL terminated,
*/
void
rearrange( char *output, char const *input,
    int n_columns, int const columns[] )
{
        int    col;           /* subscript for columns array */
        int    output_col;    /* output column counter */
        int    len;           /* length of input line */

        len = strlen( input );
        output_col = 0;

        /*
        ** Process each pair of column numbers.
        */
        for( col = 0; col < n_columns; col += 2 ){
            int    nchars = columns[col + 1] – columns[col] + 1;

            /*
            ** If the input line isn't this long or the output
            ** array is full, we're done
            */
            if( columns[col] >= len ||
                output_col == MAX_INPUT – 1 )
                    break;

            /*
            ** If there isn't room in the output array, only copy
            ** what will fit.
            */
            if( output_col + nchars > MAX_INPUT – 1)
                    nchars = MAX_INPUT – output_col – 1;

            /*
            ** Copy the relevant data.
            */
            strncpy( output + output_col, input + columns[col],
                nchars );
            output_col += nchars;
    }

    output[output_col] = '\0';
}
Why is the gets function so dangerous that it should not be used? - stackoverflow.com - use fgets() instead of gets() - and fputs() instead of puts()
1.1.1 Spacing and Comments
p5 - C is a free form language - no rules how to write statements - better good structure - comments -
p6 - #if directive to remove code #if 0
    statements
#endif
1.1.2 Preprocessor Directives
preprocessor replaces first #include statement with the contents of the library header named stdio.h etc. - other directive is #define, MAX_COLS to be the value 20, and MAX_INPUT to be the value 1000
function prototypes -




Expert C Programming

Expert C Programming - Deep C Secrets - by Peter van der Linden - WP - afu.com - Amazon - Corrections to Expert C Programming

Content
Introduction - p2
1 - C Through the Mists of Time - p7
2 - It's Not a Bug, It's a Language Feature - p33
3 - Unscrambling Declarations in C - p60
4 - The Shocking Truth: C Arrays and Pointers Are NOT the Same! - p86
5 - Thinking of Linking - p96
6 - Poetry in Motion: Runtime Data Structures - p119
7 - Thanks for the Memory - p141
8 - Why Programmers Can't Tell Halloween from Christmas Day - p173
9 - More about Arrays - p205
10 - More About Pointers - p224
11 - You Know C, So C++ is Easy! - p246-289 - end of book

Introduction
p2 - takes years - book advanced text on ANSI C - insights and techniques of experts - expert programmers build up a tool kit of techniques over the years - beginners mistake assignment i = 3 instead of comparison == - programming challenge, handy heuristic and Sample Box written in boxes - names of fruits and vegetables for variables - sometimes key point repeated - book can be read at random - true stories from practice - humor - tunefs - time_t - tune a fish
ex1 time_t

1 - C Through the Mists of Time
p7 - R ...
p17 - ANSI and ISO C - official name is ISO/IEC 9899-1990 (International Organization for Standardization International Electrotechnical Commission) - ...
p23 - Differences between K&R C and ANSI C - 4 broad categories - ...

2 - It's Not a Bug, It's a Language Feature
p33 - R ... C strengths and flaws - NUL and NULL - switch -




Let Us C

5th edition - Yashavant Kanetkar - WP - kicit.com

Preface to the Fifth Edition
best simple learning environment in Turbo C/C++ by Herbert Schildt - Amazon

p5 - C like English: Alphabets > Words > Sentences > Paragraphs
C: Alphabets Digits Special symbols > Constants Variables Keywords > Instructions > Program
p6 - Alphabets: A, B, ....., Y, Z - a, b, ......, y, z
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Special symbols: ~‘!@# %^&*()_-+=|\{} []:; "'<>,.?/
Constants, Variables and Keywords
Type of C Constants: Primary (Integer Real Character) - Secondary (Array Pointer Structure Union Enum etc.)
Rules for constructing constants ...
Types and rules of C variables ...
p12 - C keywords or reserved words ...
auto _Bool break case char     _Complex const continue default do
double else enum extern float     for goto if _Imaginary inline
int long register restrict return     short signed sizeof static struct
switch typedef union unsigned void     volatile while // = 32 + 5 (C99) + 7 (C11) = 44
_Alignas _Alignof _Atomic _Generic _Noreturn     _Static_assert _Thread_local (C11)
compiler vendors may provide own keywords like near, far, asm etc. - should be preceded by two underscores __asm, but every vendor follows this rule
p13 - The First C Program
instruction/statement rules: a) each instruction/statement separate - C program series of statements
b) must appear in the order it should be executed - unless jump or transfer of control to other statement meeded
c) blank spaces, tab, new line (enter) between words, not within variable, constant or keyword
d) small case letters
e) C is a free-form language - no rules for position for statement
f) end with statement terminator ;

interest (compound interest) #include <stdio.h>

int main()
{
    int p, n; // principle investment, period time (years)?
    float r, si; // rate of interest, simple interest

    p = 1000;
    n = 3;
    r = 8.5;

    /* formula for simple interest */
    si = p * n * r / 100;

    printf("%f" , si);
    return 0;
}
int a = 1;
int b = 5;
printf("%d %d %d %d\n", 3, 3 + 2, a, a + b);
//> 3 5 1 6
#include <stdio.h>

int main()
{
    int num;
    printf("Enter a number\n");
    scanf("%d", &num);
    printf("Now I am letting you on a secret ...\n");
    printf("You have just entered the number %d\n", num);
}
comments can't be nested: /* Cal of SI /* Author sam date 01/01/2002 */ */ invalid
... function explained, tips etc., escape sequences \n, compiler, prototype header must be added ...
p21 - Receiving Input
interest2 (input - compound interest) #include <stdio.h>

int main()
{
    int p, n;
    float r, si;
    printf("Enter values of p, n, r\n"); // p=1000, n=3, r=8.5 or other
    scanf("%d %d %f", &p, &n, &r);

    si = p * n * r / 100;
    printf("%f\n", si);
    return 0;
}
p23 - C Instructions
look at instructions we have written - there are basically 3 types of instructions in C:
(a) Type Declaration Instruction (b) Arithmetic Instruction (c) Control Instruction - for now only discussing (a) and (b) float b = a + 3.1, a = 1.5; is not correct, because a can't be used before defining it
p25 - Arithmetic Instruction
only 1 left side variable name = right side variable names and constants, called operands, combined by operators +-*/% etc.
remainder –5 % 2 yields –1, whereas, 5 % -2 yields 1
operation between an integer and real always yields a real result: 5.0/2 //> 2.5 --- 5/2 //> 2
p29 - Type Conversion in Assignments
int i; float b; i = 3.5; b = 30; --- stored: i = 3; b = 30.000000
float a, b, c ; int s; s = a * b * c / 100 + 32 / 4 - 3 * 1.1 ; --- ints promted to floats, but when assigned to s again demoted to int and stored in s --- ...
p31 - Hierarchy of Operations - 45 operaters
not as easy as BODMAS ...
precedence: {()} --- 1st */% --- 2nd +- --- 3rd = ---innermost parantheses first etc. - left to right, right to left, unambiguous (unzweideutig) or not ...
p37 - Control Instruction in C
determine control flow - 4 types: a)Sequence Control Instruction
b) Selection or Decision Control Instruction
c) Repetition or Loop Control Instruction
d) Case Control Instruction
Summery - Exercises

Chapter 2 - The Decision Control Structure
p50 - 3 major instructions: if - if-else - switch - chapter 1 sequence instructions, executed automatically
The if Statement
using keyword if enclosed with pair of parentheses - executed if true, skipped if not - evaluating truth via relational operators to compare values if equal, unequal, greater than etc.
== equal != unequal < less than > greater than <= lt or equal >= gt or equal --- (= used for assignment, == for comparison) #include <stdio.h>

int main()
{
    int num;
    printf("Enter a number less than 10 or equal 10\n"); // try 10.9 11 0.2 -3.6 etc.
    scanf("%d", &num);

    if (num <= 10)
        printf("What an obedient servant you are!\n");
    return 0;
}
2nd example ... --- dis = 0 necessary, var must be initialized or contains unpredictable value (garbage value) - in C non-zero value true, 0 false - ...
p56 - Multiple Statements within if
... else
Use of Logical Operators
p64 - 3 operators: && AND - || OR - ! NOT - ...
if else - else if ...

...

Chapter 5 - Functions & Pointers
p158 - Function like a hired person doing tasks - self-contained block of statements performing coherent task - C program is collection of functions - interaction simple or complex - #include <stdio.h>

int main()
{
    message();
    printf("Cry, and you stop the monotony!\n");

}

message()
{
printf("Smile, and the world smiles with you ...\n");
}
− Any C program contains at least one function.
− If a program contains only one function, it must be main().
− If a C program contains more than one function, then one (and only one) of these functions must be main(), because program execution always begins with main().
− There is no limit on the number of functions that might be present in a C program.
− Each function in a program is called in the sequence specified by the function calls in main().
− After each function has done its thing, control returns to main( ).When main( ) runs out of function calls, the program ends.
program execution always begins with main(). Except for this fact all C functions enjoy a state of perfect equality. No precedence, no priorities #include <stdio.h>

int main()
{
    printf("I am in main");
    italy();
    printf("\nI am finally back in main\n");
}
italy()
{
    printf("\nI am in italy");
    brazil();
    printf("\nI am back in italy");
}
brazil()
{
    printf("\nI am in brazil");
    argentina();
}
argentina()
{
    printf("\nI am in argentina");
}
outpot: I am in main
I am in italy
I am in brazil
I am in argentina
I am back in italy
I am finally back in main
main() calls other functions, which in turn call still other functions - in other words, the main() function drives other functions - a function gets called when the function name is followed by a semicolon - any function can be called from any other function, even main() can be called - function can be called any number of times - order in which the functions are defined in a program and the order in which they get called need not necessarily be same - function can call itself; such a process is called 'recursion' - function can be called from other function, but a function cannot be defined in another function - basically two types of functions: library functions ex. printf(), scanf() etc.; user-defined functions ex. argentina(), brazil() etc. - library functions are commonly required functions grouped together and stored in a library,present on the disk, written for us by people who write compilers for us - almost always a compiler comes with a library of standard functions - procedure of calling both types of functions is exactly the same
Why Use Functions
p165 - no need to write same instruction again - easier to write programs and keep track - so don’t try to cram the entire logic in one function - it is a very bad style of programming - instead, break a program into small units and write functions for each of these isolated subdivisions
Passing Values between Functions
p166 - communicate between the ‘calling’ and the ‘called’ functions - mechanism to do so is argument, or also called parameter -




Create Your Own Programming Language

Programming language - WP - Programming language theory - WP
68 Resources To Help You To Create Programming Languages - tomassetti.me
Compiler - WP
Build Your Own Lisp - Learn C and build your own programming language in 1000 lines of code! - buildyourownlisp.com - Amazon Build Your Own Lisp – October 22, 2014 - by Mr Daniel Holden
en.cppreference.com/w/c
Chapter 3 - Basics - C
How to Create a Programming Language - wikihow.com
racket-lang.org
Computer Science - Brian Kernighan on successful language design - YT




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




Python

Python (programming language) - WP:
Beautiful is better than ugly
Explicit is better than implicit
Simple is better than complex
Complex is better than complicated
Readability counts
Rather than having all of its functionality built into its core, Python was designed to be highly extensible. - adding programmable interfaces to existing applications
Python's philosophy rejects the Perl "there is more than one way to do it" approach to language design in favor of "there should be one—and preferably only one—obvious way to do it". - small core language with a large standard library and easily extensible interpreter - can move time-critical functions to extension modules written in languages such as C, or use PyPy, a just-in-time compiler. Cython is also available, which translates a Python script into C and makes direct C-level API calls into the Python interpreter - keeping it fun to use - spam and eggs (from a famous Monty Python sketch) instead of the standard foo and bar -
code is pythonic is to say that it uses Python idioms well, that it is natural or shows fluency in the language, that it conforms with Python's minimalist philosophy and emphasis on readability - contrast is unpythonic - WP - python.org
Guido Van Rossum Stepping Down From Python - YT
learnpython.org
Python and C - Comparisons and Contrasts - rose-hulman.edu
$ python -v // checks version for Mac terminal - now showing python2.7
//> /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.pyc //>
//> matches /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py
Difference between .py and .pyc files? - Python compiles the .py files and saves it as .pyc files - net-informations.com
Should I use Python 2 or Python 3 for my development activity? - python.org - What’s New In Python 3.0 - python.org




Raspberry Pi

Raspberry Pi - WP - Raspbian OS - WP - What is a Raspberry Pi? - YT - raspberrypi.org/help -
Raspberry Pi 3 Model B+ is the newest, fastest, and easiest to use -
minimum need: 1. 3B+ 2. power supply 3. micro SD card 4. keyboard 5. mouse 6. TV or computer screen 7. HDMI screen cable, adapter if needed - optional: 8. case 9. speakers or headphones 10. breadboard cables and other --- A BRAND-NEW PI FOR π DAY - YT

1. Raspberry Pi 3 Model B+ 1.4GHz 64-bit quad-core ARM Cortex-A53 Dual-band 802.11ac wireless LAN Bluetooth 4.2 - 3x faster Ethernet - Power over Ethernet support (with separate PoE HAT) NZ$63.25 inc GST
+ 2. power adapter Raspberry Pi Official White Multi Plugs In (AU EU UK US) Travel Adapter with MicroUSB Connector 5.1V 2.5A 13W NZ$21.85
+ 3. card Raspberry Pi TRANSCEND 16GB MicroSD Card Pre-loaded with NOOBS V2 NZ$27.94
+ 8. case Official Red & White Enclosure for Raspberry Pi 3 Model B and B+ NZ$20.70
+ 10. breadboard cables Raspberry Pi Breadboarding Wire Bundle NZ$18.40
+ 10.a lead cables test Raspberry Pi Alligator Clip Test Lead Cables (Multi Colours) 40cm Long (Set of 10) NZ$10.35
+ 11. camera Raspberry Pi Infrared Night Vision Camera Kit. Focal Adjustable, 1080P, 5MP, Sensitive Infrared Lights. Quick Install Guide NZ$72.45
+ 4. keyboard
+ 5. mouse
+ 6. screen TV or computer
+ 7. HDMI cable + Raspberry Pi Official White HDMI Cable 2m Male to Male HDMI 2.0 with Ethernet and Audio Return Channel Support 3D, 4K, 2160P/60Hz and X.V.colour NZ$16.10
9. speakers or headphones

--- Combo Deal Raspberry Pi 3 Model B+ Official Starter Kit White Edition with OS (Inc 1. New Pi3 Mainboard, 2. Multi Plugs Aadapter, 8. Red & White Case, 3. 16GB NOOBS Card, 7. HDMI 2M Cable) NZ$150.66 - pbtech.co.nz
What languages are used to program raspberry PI? - raspberrypi.org
Python 2 or 3 - raspberrypi.org

Other shop pishop.nz




Notes

Mchines for world knowledge 300 Exabytes, ship SH and spaceship SS - Computers should do what humans want them to do - input output - keyboard pad touchscreen cam mic controller etc. - based binary - ASM and C needed - terminal - IN HTML CSS JS WASM - Arduino Rapberry PI etc. - Linux - games animation sounddesign graficdesign - art FP MP WR - O MG -




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
Richard Stallman: Dangers of IoT and Amazon Alexa - YT

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

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




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

: - 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.





 

https://www.symptoma.es