What kind of language is C described as in this lecture?
A high-level structured programming language often used for microcontroller applications.
What three main things does this lecture focus on?
Good coding practices, C operators, and flow control structures.
What are the main sections of the lecture?
C-language basics (formatting, comments, preprocessor, statements, variables, operators) and flow control (if, switch, while, for).
Why is code formatting important?
It improves readability, maintainability, and makes programs easier to understand.
Name three good code formatting practices.
Use descriptive names, indent nested code blocks, delete redundant code.
What does “each function/class should have one purpose” mean?
Each function should do one clear job, not many unrelated things.
Why is readability more important than cleverness in code?
Readable code is easier to debug, maintain, and understand by others.
What is refactoring?
Rewriting existing code to improve structure and readability without changing behaviour.
Why should you use version control and backups?
To keep track of changes and avoid losing work.
What are comments in C used for?
To explain what the program or specific code blocks do, for future readers.
Are comments compiled into machine code?
No, the compiler ignores comments.
How do you write a multi-line comment in C?
Between /* and */.
How do you write a single-line comment in C?
Start the line or part of the line with //.
Give an example of a single-line comment in C.
A = 10; // This line sets variable A to 10
What is the C pre-processor?
A tool that runs before compilation and processes lines starting with #.
What does the #include directive do?
It includes the contents of a header file into the source file.
How is #include used for system header files?
include <header_file.h></header_file.h>
How is #include used for user-defined header files?
include “my_library.h”
What does the #define directive do?
It defines a macro so that a name is replaced by a value or code snippet.
Give an example of #define for a constant value.
define pi 3.1415
Give an example of #define for a macro function.
define cube(x) (x) * (x) * (x)
What is a statement in C?
A complete instruction ending with a semicolon.
What are operators and operands?
Operators represent actions; operands are the data they act on.
What is a function in C?
A block of code that can take inputs (arguments) and optionally return a value.