
C语言 course note
Nikeneo233
这个作者很懒,什么都没留下…
展开
-
Types of Variables, Assignment, printf, Tracing, Watch Window,Sizeof
Computer MemoryRAM: Random Access MemoryStores data temporally for use.Bit:“Binary Digit” –The smallest unit of information on a machine…(Single bit holds 0 or 1)Byte:1 byte contains 8 bi...原创 2019-06-23 07:03:04 · 102 阅读 · 0 评论 -
Pointers, Pass by Reference, Passing Arrays and C-Strings, Pointer Arithmetic
PointerFirstly, let’s review how to print the hexadecimal(16 base)Remember: Every time the program is run, the address of data will likely be different.When declare...原创 2019-07-02 16:56:08 · 133 阅读 · 0 评论 -
The Pre-Processor, Assert, Build Targets, Function Comments
Preprocessor DirectivesPreprocessor Directives tell the Preprocessor to perform specific actions:#include: Copy the contents of the included file into this source file…#define: Create a Ma...原创 2019-07-02 16:56:21 · 153 阅读 · 0 评论 -
Multi-Dimensional Arrays, main Parameters, Casting, void Pointers
2D Arraystypearray_name[dimension1] [dimension2]A 2D array is often useful for storing tabular dataArray initialization:Multi-Dimensional Arrays: 3D Arrays or moreF...原创 2019-07-02 16:56:34 · 219 阅读 · 0 评论 -
Dynamic Memory, The Heap, Memory Leaks, Recursive Composition
Dynamic Memory Allocation: mallocallocated memory at runtimeStack vs Heap:Stack Frames store per function call:Local variables, parameters, return value Heap stores:Dynamic alloca...原创 2019-07-02 16:57:12 · 153 阅读 · 0 评论 -
typedef, Testing, VS Memory Patterns, New SLN, Warnings
view the “Warning Level”:right click the project -> choose the “properties” -> go to “C/C++” section, and find the “General” tab->set the level to leve 4...原创 2019-07-02 16:56:43 · 66 阅读 · 0 评论 -
File Input and Output, Hex Editor
File input/output:Writing to text files is very similar to using printf..Reading in text from a text file:is very similar to using scanfA Hex Editor is a program...原创 2019-07-02 16:56:54 · 165 阅读 · 0 评论 -
Function Pointers, Callbacks, QSort, BSearch
原创 2019-07-02 16:57:03 · 95 阅读 · 0 评论 -
Bitwise Operators
Bitwise Operators:Bit ShiftingBit Flags:int alive = 1;int tired = 2; Using Bit Flags to pack multiple pieces of knowledge into a single variableint studen...原创 2019-07-02 16:57:21 · 283 阅读 · 0 评论 -
Header Files, Static Libraries, P1Colour, Input Polling
The .h FileThe header file is used to declare function prototypesIn this case: the main.c file includes the myfunction.h header file to get access to the myfunction.c functions.As this Prot...原创 2019-07-02 16:57:41 · 130 阅读 · 0 评论 -
Windows Programming, MSDN, Win32 MsgBox
Windows Handles (窗口句柄)The Windows Operating system uses “handles” to refer to components of windowsHANDLE:This is a Windows.h type and typedef void* HANDLE(address)It stores the handle of...原创 2019-07-15 17:21:44 · 160 阅读 · 0 评论 -
Structures, Dot Operator, Passing Structures, Data Abstraction,
StructuresUsing StructuresPassing Structures to Functions, by ValueReturning a Structure from a FunctionArrays of Structuressizeof and structThe Ord...原创 2019-06-27 11:24:44 · 108 阅读 · 0 评论 -
Function Bugs, Side Effects, Recursion, Enumeration,Slot Machine
Common Function Bugs / Mistakes :Functions with Side Effects: (Any extra actions that a function does)A function with no side effects is known as a pure function (otherwise, call impu...原创 2019-06-27 11:21:37 · 152 阅读 · 0 评论 -
Formatted printf, Addressof, scanf, const, Overflow, Truncation
printf (multiple variables)int age = 33;int weight = 55;int boredom = 55;printf (“age: %d\n weight: %d\n boredom: %d\n”, age, weight, boredom”);The instruction in printfprintf: The Width Opt...原创 2019-06-23 07:41:54 · 109 阅读 · 0 评论 -
Characters, ASCII, scanf with char, Format
Escape Sequence Character CodeNotice: A variable can only store one thing at a time, and hence if changed via assignment, the new value overwrites the old value.When use set a char to a char...原创 2019-06-23 08:33:17 · 119 阅读 · 0 评论 -
Arrays, Memory Window, Math, Random Numbers
ArraysDeclarationint array1[5]; (number is how much components in the array)this array includes the components: array1[0], array1[1], array1[2], array1[3], array1[4]This process can b...原创 2019-06-27 10:28:34 · 95 阅读 · 0 评论 -
Solving Programming Problems, Whitespace, The Debugger
Input-Process-OutputProcedure:Understand the problem Identify the outputs Decide the type of data Design an algorithmDesign Algorithm:Analysis task Solve the problem by hand Solve ...原创 2019-06-27 10:52:15 · 197 阅读 · 0 评论 -
Practical Test Reminders, Character Arrays, C-Strings
Printing a Character ArrayPrinting blocks of text (%s) C-Stringprint from the array specified, until it finds an element in the char array that has the value 0C-Strings: a collecti...原创 2019-06-27 10:53:42 · 166 阅读 · 0 评论 -
Selection, if, else, Relational Operators,Nested Selection,else if, Logical Operators
The if Keyword a == b means does a equal b? a != b means does a not equal b? a > b means is a greater than b? a >= b ...原创 2019-06-27 11:03:01 · 105 阅读 · 0 评论 -
Common Selection Bugs, switch, Conditional Operator,Repetition, while, do while, break, continue
Notice: the comparation of char: =>For the on litter (char), the ‘’ should be used inside comparationFor the string use the “ ” :Do not use if (input == 'y' || 'Y')should be...原创 2019-06-27 11:05:27 · 188 阅读 · 0 评论 -
for, Arrays and for Loops,for Loop bugs, Nested Selection
for KeywordUsing for loops with ArraysOutput all the elements on the array.Divide Each Element by 2Can use while to achieve same targetSimilar with using %s with print...原创 2019-06-27 11:08:58 · 168 阅读 · 0 评论 -
Nested Loops, goto, Scope, Variable Lifespan,
Nested Loops:Nested while loops:ASCII Art Triangle:Printing a Holiday Tree:The goto Keyword:The life span of variable:Once ...原创 2019-06-27 11:12:17 · 224 阅读 · 0 评论 -
Functions, void, return, The Call Stack,Arguments, Parameters, Call by Value, Scope, Returning Data
Invoking Functions:The void keyword for invoking functions(when define a funciton):Define and call a function:The return key in function(when we need the function return something to...原创 2019-06-27 11:16:42 · 148 阅读 · 0 评论 -
Windows API
Windows API: StringsASCII vs Unicode (char vs wchar_t)sizeof(char)evaluates to be 1 byte.sizeof(wchar_t) evaluates to be 2 bytes.Windows API: System FunctionsThese will return an int...原创 2019-07-02 16:57:32 · 558 阅读 · 0 评论