Added book examples

This commit is contained in:
Louise Brown
2022-04-08 16:12:38 +01:00
parent 5b205092a7
commit 1c0a9e7b6a
59 changed files with 1381 additions and 0 deletions

22
C6/inc_dec_examples.c Normal file
View File

@@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// Declare some variables
int a, b;
// Note: Order of a,b indicates the order in which operations are carried out on execution
// Increment operators
b = 3;
a = ++b; // b is now 4, a is also 4
a = b++; // a is 4, b is now 5,
// Decrement operators (reset a back to 3)
b = 3;
a = b--; // a is 3, b is now 2
a = --b; // b is now 1, a is also 1
return 0; // Exit from main
}