Skip to content
CramShare
PremiumStudy guide

C NOTES FOR PROFESSIONAL (computer science)

CSC101 Computer science · Cambridge university

Updated today

It covers computer science logics

Pages
340
Academic year
2025/2026
Language
English

What’s included

Preview 3 of 340 pages

See the first 3 pages exactly as they appear in the document.

Read page 1 as text

C Notes for Professionals C Notes for Professionals GoalKicker.com Free Programming Books Disclaimer This is an unocial free book created for educational purposes and is not aliated with ocial C group(s) or company(s). All trademarks and registered trademarks are the property of their respective owners 300+ pages of professional hints and tricks

Read page 2 as text

Contents About 1 ................................................................................................................................................................................... Chapter 1: Getting started with C Language 2 .................................................................................................. Section 1.1: Hello World 2 ................................................................................................................................................. Section 1.2: Original "Hello, World!" in K&R C 4 .............................................................................................................. Chapter 2: Comments 6 ................................................................................................................................................. Section 2.1: Commenting using the preprocessor 6 ...................................................................................................... Section 2.2: /* */ delimited comments 6 ........................................................................................................................ Section 2.3: // delimited comments 7 ............................................................................................................................ Section 2.4: Possible pitfall due to trigraphs 7 .............................................................................................................. Chapter 3: Data Types 9 ............................................................................................................................................... Section 3.1: Interpreting Declarations 9 .......................................................................................................................... Section 3.2: Fixed Width Integer Types (since C99) 11 ................................................................................................. Section 3.3: Integer types and constants 11 .................................................................................................................. Section 3.4: Floating Point Constants 12 ........................................................................................................................ Section 3.5: String Literals 13 .......................................................................................................................................... Chapter 4: Operators 14 ............................................................................................................................................... Section 4.1: Relational Operators 14 ............................................................................................................................... Section 4.2: Conditional Operator/Ternary Operator 15 ............................................................................................. Section 4.3: Bitwise Operators 16 ................................................................................................................................... Section 4.4: Short circuit behavior of logical operators 18 .......................................................................................... Section 4.5: Comma Operator 19 ................................................................................................................................... Section 4.6: Arithmetic Operators 19 .............................................................................................................................. Section 4.7: Access Operators 22 ................................................................................................................................... Section 4.8: sizeof Operator 23 ....................................................................................................................................... Section 4.9: Cast Operator 24 ......................................................................................................................................... Section 4.10: Function Call Operator 24 ......................................................................................................................... Section 4.11: Increment / Decrement 24 ......................................................................................................................... Section 4.12: Assignment Operators 24 .......................................................................................................................... Section 4.13: Logical Operators 26 .................................................................................................................................. Section 4.14: Pointer Arithmetic 27 .................................................................................................................................. Section 4.15: _Alignof 28 .................................................................................................................................................. Chapter 5: Boolean 30 .................................................................................................................................................... Section 5.1: Using stdbool.h 30 ........................................................................................................................................ Section 5.2: Using #define 30 .......................................................................................................................................... Section 5.3: Using the Intrinsic (built-in) Type _Bool 31 ............................................................................................... Section 5.4: Integers and pointers in Boolean expressions 31 .................................................................................... Section 5.5: Defining a bool type using typedef 32 ...................................................................................................... Chapter 6: Strings 33 ....................................................................................................................................................... Section 6.1: Tokenisation: strtok(), strtok_r() and strtok_s() 33 .................................................................................. Section 6.2: String literals 35 ........................................................................................................................................... Section 6.3: Calculate the Length: strlen() 36 ................................................................................................................ Section 6.4: Basic introduction to strings 37 .................................................................................................................. Section 6.5: Copying strings 37 ....................................................................................................................................... Section 6.6: Iterating Over the Characters in a String 40 ............................................................................................. Section 6.7: Creating Arrays of Strings 40 ..................................................................................................................... Section 6.8: Convert Strings to Number: atoi(), atof() (dangerous, don't use them) 41 ........................................... Section 6.9: string formatted data read/write 42 .........................................................................................................

Read page 3 as text

Section 6.10: Find first/last occurrence of a specific character: strchr(), strrchr() 43 ............................................... Section 6.11: Copy and Concatenation: strcpy(), strcat() 44 ........................................................................................ Section 6.12: Comparsion: strcmp(), strncmp(), strcasecmp(), strncasecmp() 45 .................................................... Section 6.13: Safely convert Strings to Number: strtoX functions 46 .......................................................................... Section 6.14: strspn and strcspn 48 ................................................................................................................................. Chapter 7: Literals for numbers, characters and strings 50 ...................................................................... Section 7.1: Floating point literals 50 ............................................................................................................................... Section 7.2: String literals 50 ........................................................................................................................................... Section 7.3: Character literals 50 .................................................................................................................................... Section 7.4: Integer literals 51 ......................................................................................................................................... Chapter 8: Compound Literals 53 ............................................................................................................................. Section 8.1: Definition/Initialisation of Compound Literals 53 ...................................................................................... Chapter 9: Bit-fields 55 .................................................................................................................................................. Section 9.1: Bit-fields 55 .................................................................................................................................................... Section 9.2: Using bit-fields as small integers 56 .......................................................................................................... Section 9.3: Bit-field alignment 56 .................................................................................................................................. Section 9.4: Don'ts for bit-fields 57 ................................................................................................................................. Section 9.5: When are bit-fields useful? 58 .................................................................................................................... Chapter 10: Arrays 60 ...................................................................................................................................................... Section 10.1: Declaring and initializing an array 60 ....................................................................................................... Section 10.2: Iterating through an array eciently and row-major order 61 ............................................................ Section 10.3: Array length 62 ........................................................................................................................................... Section 10.4: Passing multidimensional arrays to a function 63 ................................................................................. Section 10.5: Multi-dimensional arrays 64 ...................................................................................................................... Section 10.6: Define array and access array element 67 ............................................................................................. Section 10.7: Clearing array contents (zeroing) 67 ....................................................................................................... Section 10.8: Setting values in arrays 68 ........................................................................................................................ Section 10.9: Allocate and zero-initialize an array with user defined size 68 ............................................................. Section 10.10: Iterating through an array using pointers 69 ........................................................................................ Chapter 11: Linked lists 71 ............................................................................................................................................. Section 11.1: A doubly linked list 71 .................................................................................................................................. Section 11.2: Reversing a linked list 73 ............................................................................................................................ Section 11.3: Inserting a node at the nth position 75 ..................................................................................................... Section 11.4: Inserting a node at the beginning of a singly linked list 76 .................................................................... Chapter 12: Enumerations 79 ...................................................................................................................................... Section 12.1: Simple Enumeration 79 ............................................................................................................................... Section 12.2: enumeration constant without typename 80 .......................................................................................... Section 12.3: Enumeration with duplicate value 80 ....................................................................................................... Section 12.4: Typedef enum 81 ....................................................................................................................................... Chapter 13: Structs 83 ..................................................................................................................................................... Section 13.1: Flexible Array Members 83 ......................................................................................................................... Section 13.2: Typedef Structs 85 ..................................................................................................................................... Section 13.3: Pointers to structs 86 .................................................................................................................................. Section 13.4: Passing structs to functions 88 ................................................................................................................. Section 13.5: Object-based programming using structs 89 ......................................................................................... Section 13.6: Simple data structures 91 .......................................................................................................................... Chapter 14: Standard Math 93 ................................................................................................................................... Section 14.1: Power functions - pow(), powf(), powl() 93 .............................................................................................. Section 14.2: Double precision floating-point remainder: fmod() 93 ..........................................................................

337 more pages after this

You’ve read 3 of 340. Unlock once and it stays in your library — and if the rest doesn’t match what you just read, you get a refund.

$12.85

Yours permanently