Home C Learning Setup C Basics Foundations Core Intermediate Advanced Professional Systems Expert Practice Fundamentals Tasks First C Lesson C Get Started C Syntax Statements C Output Print Text New Lines Comments Variables Format Specifiers Change Values Multiple Variables Variable Names Real-Life Variables Data Types Characters Numbers Decimal Precision sizeof Type Real-Life Extended Types Type Conversion Constants Operators Arithmetic Assignment Comparison Logical Precedence Booleans If If Else Else If Short If Switch While Do While For Loop C Help Login
Site Home About Resources Download Program Help Register Login User Profile
Lessons C Lessons C Lesson 001 C++ Lessons C++ Lesson 001
Admin CRUD Task List Add Task Edit Current Task Task Checks Users DB
API Tasks List JSON Current Task JSON Health

BYTE FORGE EDU / C Learning Track

C Lessons

Start with the C language, source files, Clang compile workflow, CMD output, and small beginner programs. Each lesson keeps its own folder and materials.

Track: C Programming
Compiler: Clang
Main folder: c_lessons
Lesson files use c_topic_number prefix

Setup And First Program

These lessons prepare the student to understand source files, compile with Clang, and run programs in CMD.

001 - What Is C?

C is a compiled programming language used for command line tools, systems, hardware, and game technology foundations.

002 - C Work Files

Source files, folders, file extensions, and how lesson materials are stored.

c_workfiles_002
003 - First C Program

Create a small program with main, printf, and return 0.

c_firstprogram_003
004 - Compile With Clang

Compile a .c file into an .exe file using Clang.

c_compileclang_004
005 - Run EXE In CMD

Run the compiled program and read its output in the command prompt.

c_runexe_005
006 - Compiler Errors

Learn how to read simple compiler errors and fix one problem at a time.

c_errors_006
015 - C Get Started

Prove the full source file, Clang compile, EXE, and CMD output workflow from one simple task package.

016 - C Syntax

Build the visible C program skeleton: include line, main, braces, statements, and return 0.

017 - Statements

Learn that a C program is made from statements and that simple statements usually end with semicolons.

018 - C Output

Use visible output as the first proof that the program ran correctly.

019 - Print Text

Print exact text labels with printf so both the user and the task checker can read them.

020 - New Lines

Use newline characters so output stays readable line by line.

021 - Comments

Add simple comments that explain the code for humans.

022 - Create Variables

Create simple integer variables and print their values.

023 - Format Specifiers

Use %d correctly when printing integer values.

024 - Change Values

Change a variable after it was created and print the new result.

025 - Multiple Variables

Work with several variables in the same small program.

026 - Variable Names

Use readable names that explain what each value means.

027 - Variable Real-Life Examples

Connect variables to real meanings like temperature and score.

028 - Data Types

Use int, char, and float in one small starter program.

029 - Characters

Store and print one-character values with char.

030 - Numbers

Compare whole-number and decimal-number values.

031 - Decimal Precision

Control how many digits are shown after the decimal point.

032 - Memory Size and sizeof

Inspect how many bytes common data types use.

033 - Data-Type Real-Life Example

Match real values to int, char, and float.

034 - Extended Types

Use long and double in simple examples.

035 - Type Conversion

Convert a value from one type to another and print both results.

036 - Constants

Protect important values so they are not changed accidentally.

037 - Operators Overview

See operators as symbols that act on values and variables.

038 - Arithmetic Operators

Practice the basic math operators used in calculations.

039 - Assignment Operators

Store and update values with assignment operators.

040 - Comparison Operators

Compare values and print true-style result messages.

041 - Logical Operators

Combine conditions with &&, ||, and !.

042 - Operator Precedence

See how brackets change the final result of an expression.

043 - Booleans

Use true and false style logic with integer results in C.

044 - If

Run code only when one condition is true.

045 - If Else

Choose between a true block and a false block.

046 - Else If

Check more than one condition in order.

047 - Short Hand If

Use the ternary operator for a short condition result.

048 - Switch

Select one branch from fixed integer cases.

049 - While Loop

Repeat code while a condition stays true.

050 - Do While Loop

Run the loop body once before checking the condition.

051 - For Loop

Use a counted loop with start, condition, and step.

C Basics

The first real syntax lessons. Each item will become its own lesson page and downloadable code files.

007 - printf

Print text, new lines, and simple formatted output.

c_printf_007
008 - Variables

Store numbers, characters, and simple values.

c_variables_008
009 - If / Else

Make decisions with conditions and comparison operators.

c_ifelse_009
010 - Loops

Repeat code with while, for, and do while.

c_loops_010
011 - Functions

Split programs into reusable blocks.

c_functions_011
012 - Arrays

Store many values under one variable name.

c_arrays_012
013 - Strings

Work with text as character arrays.

c_strings_013
014 - Files

Write and read simple text files.

c_files_014

Practice Projects

After syntax lessons, these projects can use the same C folders and file prefix system.

Calculator

Use variables, input, math, and if/else.

Number Guessing Game

Use loops, random numbers, input, and win conditions.

Quiz Program

Use arrays, score, and repeated questions.

Menu Program

Use switch or if/else to run different actions.

Text Notes Program

Use file write/read for simple saved data.

Grade Average Program

Use arrays and functions to calculate results.

C Fundamentals Task Catalog

These exercises build the foundation students need before pointers, structures, files, dynamic memory, operating-system work, or direct hardware programming. C is used everywhere from small embedded controllers to compilers, kernels, drivers, games, industrial systems, and high-performance software.

1.a CHAR VARIABLES AND ASCII BASICS

CHAR
What is learned: CHAR VARIABLES AND ASCII BASICS
Why it matters: Characters and bytes are used for text, serial communication, protocols, device commands, and raw memory data.

  • 1.a1
    Declare one "char" variable, store letter "A", and print it with "printf".
  • 1.a2
    Declare three "char" variables, store initials, and print them on one line.
  • 1.a3
    Store one digit as a character, print the character and then print its ASCII code as integer.
  • 1.a4
    Read one character from keyboard and print "You typed: X".
  • 1.a5
    Read two characters and print them in reverse order.
  • 1.a6
    Store lowercase letter and print its uppercase variant using ASCII math.
  • 1.a7
    Store uppercase letter and print its lowercase variant using ASCII math.
  • 1.a8
    Check if a character is between "A-Z", "a-z", or "0-9".
  • 1.a9
    Print a small ASCII table from code 65 to 90.
  • 1.a10
    Make a program that reads one character and tells if it is vowel or consonant.

2.a INTEGER VARIABLES AND BASIC ARITHMETIC

INT
What is learned: INTEGER VARIABLES AND BASIC ARITHMETIC
Why it matters: Integers are used for counters, indexes, states, timing, addresses, measurements, and control decisions.

  • 2.a1
    Declare two "int" variables and print their sum.
  • 2.a2
    Read two integers and print sum, subtraction, multiplication, and division.
  • 2.a3
    Read one integer and print its square and cube.
  • 2.a4
    Read three integers and print the largest one.
  • 2.a5
    Read three integers and print the smallest one.
  • 2.a6
    Swap two integers using a third variable and print before and after.
  • 2.a7
    Swap two integers without a third variable.
  • 2.a8
    Read one integer and check if it is even or odd.
  • 2.a9
    Read one integer and check if it is positive, negative, or zero.
  • 2.a10
    Read seconds as integer and convert to hours, minutes, and seconds.

3.a FLOAT VARIABLES AND SIMPLE REAL NUMBER TASKS

FLOAT
What is learned: FLOAT VARIABLES AND SIMPLE REAL NUMBER TASKS
Why it matters: Float values are common in sensors, control calculations, graphics, simulation, and engineering measurements.

  • 3.a1
    Declare one "float" variable and print it with 2 digits after decimal point.
  • 3.a2
    Read two "float" values and print their sum and average.
  • 3.a3
    Read rectangle width and height as "float" and print area and perimeter.
  • 3.a4
    Read circle radius as "float" and print diameter, circumference, and area.
  • 3.a5
    Read temperature in Celsius and print Fahrenheit.
  • 3.a6
    Read temperature in Fahrenheit and print Celsius.
  • 3.a7
    Read speed and time, then print distance.
  • 3.a8
    Read base and height of triangle and print area.
  • 3.a9
    Read three "float" values and print the largest one.
  • 3.a10
    Read item price and quantity, then print total price with 2 digits after decimal point.

4.a UNSIGNED CHAR AS A SMALL NUMBER AND BYTE

UNSIGNED INTEGER TYPES
What is learned: UNSIGNED CHAR AS A SMALL NUMBER AND BYTE
Why it matters: Unsigned integers represent bytes, flags, registers, sizes, counters, colors, network data, and hardware states.

  • 4.a1
    Declare "unsigned char" with value 255 and print it as a number.
  • 4.a2
    Declare "unsigned char" with value 0 and increment it ten times.
  • 4.a3
    Read a number from 0 to 255 into an "unsigned int", convert it to "unsigned char", and print it.
  • 4.a4
    Store an ASCII code in "unsigned char" and print both the number and character.
  • 4.a5
    Use "unsigned char" as a byte and print it in decimal and hexadecimal.
  • 4.a6
    Store red, green, and blue values in three "unsigned char" variables.
  • 4.a7
    Add two small "unsigned char" values and print the result as "unsigned int".
  • 4.a8
    Test whether bit 0 of an "unsigned char" value is set.
  • 4.a9
    Set, clear, and toggle one bit in an "unsigned char" value.
  • 4.a10
    Read four byte values and print them as fake IPv4 format "a.b.c.d".

4.b UNSIGNED INT FOR NON-NEGATIVE WHOLE NUMBERS

UNSIGNED INTEGER TYPES
What is learned: UNSIGNED INT FOR NON-NEGATIVE WHOLE NUMBERS
Why it matters: Unsigned integers represent bytes, flags, registers, sizes, counters, colors, network data, and hardware states.

  • 4.b1
    Declare one "unsigned int" and print it with "%u".
  • 4.b2
    Read one positive number into "unsigned int" and print it.
  • 4.b3
    Read two "unsigned int" values and print their sum.
  • 4.b4
    Read two "unsigned int" values and print product and division.
  • 4.b5
    Subtract a bigger unsigned number from a smaller one and observe the result.
  • 4.b6
    Print the maximum "unsigned int" value by using "UINT_MAX" from "limits.h".
  • 4.b7
    Use "unsigned int" for a counting loop from 0 to 20.
  • 4.b8
    Read an "unsigned int" and classify it as 0-100, 101-1000, or above 1000.
  • 4.b9
    Use an "unsigned int" as a bit-field value and test its first eight bits.
  • 4.b10
    Read file size in bytes as "unsigned int" and convert it to kilobytes and remaining bytes.

5.a MORE PRECISION THAN FLOAT

DOUBLE
What is learned: MORE PRECISION THAN FLOAT
Why it matters: Double precision is important when calculations need more accuracy than float can provide.

  • 5.a1
    Declare one "double" value and print it with 6 digits after decimal point.
  • 5.a2
    Read two "double" values and print sum, difference, product, and division.
  • 5.a3
    Read resistor voltage and current as "double" and print power using "P = U * I".
  • 5.a4
    Read length, width, and height as "double" and print box volume.
  • 5.a5
    Read loan amount, interest percent, and print one-year result.
  • 5.a6
    Compare same value stored in "float" and "double" and print both.
  • 5.a7
    Read three "double" values and print their average with 4 digits after decimal point.
  • 5.a8
    Convert millimeters to meters using "double".
  • 5.a9
    Read analog sensor value as "double" and print if it is below, inside, or above allowed range.
  • 5.a10
    Read frequency and period values and verify relation with simple calculations.

6.a PLUS, MINUS, MULTIPLY, DIVIDE, MODULO

BASIC OPERATORS
What is learned: PLUS, MINUS, MULTIPLY, DIVIDE, MODULO
Why it matters: Arithmetic operators are the base of calculations, conversion formulas, timers, counters, and control algorithms.

  • 6.a1
    Read two integers and print "a+b".
  • 6.a2
    Read two integers and print "a-b".
  • 6.a3
    Read two integers and print "a*b".
  • 6.a4
    Read two integers and print integer division and remainder.
  • 6.a5
    Make a calculator that uses one operator character "+ - * /".
  • 6.a6
    Read one number and increment it with "++", then print.
  • 6.a7
    Read one number and decrement it with "--", then print.
  • 6.a8
    Use "+=", "-=", "*=", "/=" on one variable and print after each step.
  • 6.a9
    Read one number and print "number % 10" to get last digit.
  • 6.a10
    Read one 3-digit integer and print sum of its digits.

7.a COMPARISONS AND DECISIONS

RELATIONAL AND LOGICAL OPERATORS
What is learned: COMPARISONS AND DECISIONS
Why it matters: Comparison and logical operators decide when software, machines, alarms, menus, and safety rules should act.

  • 7.a1
    Read two integers and print if first is greater than second.
  • 7.a2
    Read two integers and print if they are equal or not equal.
  • 7.a3
    Read age and print if person is adult.
  • 7.a4
    Read one number and check if it is between 10 and 99.
  • 7.a5
    Read one year and check if it is leap year with simple rules.
  • 7.a6
    Read username length and password length values and check if both meet minimum size.
  • 7.a7
    Read exam score and attendance percent and print if student passes.
  • 7.a8
    Read temperature and humidity and print if greenhouse alarm should be on.
  • 7.a9
    Read three side lengths and check if they can form a triangle.
  • 7.a10
    Read work voltage and current state and print if machine can start.

7.b LOGICAL AND, OR, AND NOT

RELATIONAL AND LOGICAL OPERATORS
What is learned: LOGICAL AND, OR, AND NOT
Why it matters: Comparison and logical operators decide when software, machines, alarms, menus, and safety rules should act.

  • 7.b1
    Read two integer conditions and print the result of "condition1 && condition2".
  • 7.b2
    Read two integer conditions and print the result of "condition1 || condition2".
  • 7.b3
    Read one integer condition and print the result of "!condition".
  • 7.b4
    Make and print the full truth table for logical AND "&&".
  • 7.b5
    Make and print the full truth table for logical OR "||".
  • 7.b6
    Read age and permission state and allow entry only when both are valid.
  • 7.b7
    Read alarm state and emergency state and activate warning when either is true.
  • 7.b8
    Read one value and use logical NOT to detect zero.
  • 7.b9
    Combine "&&", "||", and "!" in one machine-start condition with parentheses.
  • 7.b10
    Compare logical operators with bitwise operators using values 0, 1, 2, and 3.

8.a SHIFT LEFT, SHIFT RIGHT, AND MASKS

BITWISE SHIFTS AND BITWISE BASICS
What is learned: SHIFT LEFT, SHIFT RIGHT, AND MASKS
Why it matters: Bitwise operations directly control flags, registers, permissions, protocols, packed data, and embedded hardware pins.

  • 8.a1
    Store number 1 and shift it left by 1, 2, 3, and 4 positions.
  • 8.a2
    Store number 128 and shift it right by 1, 2, 3 positions.
  • 8.a3
    Read one integer and print result of "value << 1".
  • 8.a4
    Read one integer and print result of "value >> 1".
  • 8.a5
    Use bitwise AND to check if a number is odd or even.
  • 8.a6
    Store one byte value and test if bit 0 is set.
  • 8.a7
    Store one byte value and test if bit 7 is set.
  • 8.a8
    Set bit 3 in a value using OR.
  • 8.a9
    Clear bit 2 in a value using AND with mask.
  • 8.a10
    Toggle bit 4 in a value using XOR.

8.b BITWISE AND

BITWISE SHIFTS AND BITWISE BASICS
What is learned: BITWISE AND
Why it matters: Bitwise operations directly control flags, registers, permissions, protocols, packed data, and embedded hardware pins.

  • 8.b1
    Calculate "12 & 10" and print the decimal result.
  • 8.b2
    Print two input values and their bitwise AND result in decimal and hexadecimal.
  • 8.b3
    Use "value & 1" to check if an integer is odd or even.
  • 8.b4
    Use a mask to read bit 0 from an "unsigned char" value.
  • 8.b5
    Use a mask to read bit 3 from an "unsigned char" value.
  • 8.b6
    Keep only the lower four bits of an "unsigned char" value.
  • 8.b7
    Keep only the upper four bits of an "unsigned char" value.
  • 8.b8
    Clear bit 2 with an AND mask.
  • 8.b9
    Compare "char", "unsigned char", and "unsigned int" AND results after conversion.
  • 8.b10
    Read a machine-state byte and print which masked input bits are active.

8.c BITWISE OR

BITWISE SHIFTS AND BITWISE BASICS
What is learned: BITWISE OR
Why it matters: Bitwise operations directly control flags, registers, permissions, protocols, packed data, and embedded hardware pins.

  • 8.c1
    Calculate "12 | 10" and print the decimal result.
  • 8.c2
    Print two input values and their bitwise OR result in decimal and hexadecimal.
  • 8.c3
    Set bit 0 in an "unsigned char" value.
  • 8.c4
    Set bit 3 in an "unsigned char" value.
  • 8.c5
    Set two bits at the same time with one OR mask.
  • 8.c6
    Combine two non-overlapping status masks into one value.
  • 8.c7
    Add a READ permission bit to a permission value.
  • 8.c8
    Add WRITE and EXECUTE permission bits to a permission value.
  • 8.c9
    Combine four digital input states into one "unsigned int" state value.
  • 8.c10
    Build one output-control byte by setting selected motor, lamp, and alarm bits.

8.d BITWISE XOR

BITWISE SHIFTS AND BITWISE BASICS
What is learned: BITWISE XOR
Why it matters: Bitwise operations directly control flags, registers, permissions, protocols, packed data, and embedded hardware pins.

  • 8.d1
    Calculate "12 ^ 10" and print the decimal result.
  • 8.d2
    Print two input values and their bitwise XOR result in decimal and hexadecimal.
  • 8.d3
    Toggle bit 0 in an "unsigned char" value.
  • 8.d4
    Toggle bit 4 in an "unsigned int" value.
  • 8.d5
    Toggle two selected bits with one XOR mask.
  • 8.d6
    Apply the same XOR mask twice and verify that the original value returns.
  • 8.d7
    Compare two bytes with XOR and print whether any bit is different.
  • 8.d8
    Count changed low-order bits between two small integer values.
  • 8.d9
    Use XOR to invert selected output-state bits without changing the others.
  • 8.d10
    Build a small two-value XOR demonstration table.

8.e BITWISE NOT

BITWISE SHIFTS AND BITWISE BASICS
What is learned: BITWISE NOT
Why it matters: Bitwise operations directly control flags, registers, permissions, protocols, packed data, and embedded hardware pins.

  • 8.e1
    Apply "~" to an "unsigned char" value and print the converted byte result.
  • 8.e2
    Apply "~" to an "unsigned int" value and print decimal and hexadecimal results.
  • 8.e3
    Invert all eight bits of one byte value.
  • 8.e4
    Create a clear-bit mask by using NOT on a one-bit mask.
  • 8.e5
    Clear bit 0 with "value & ~(1u << 0)".
  • 8.e6
    Clear bit 5 with "value & ~(1u << 5)".
  • 8.e7
    Invert only the lower four bits while preserving the upper four bits.
  • 8.e8
    Compare logical NOT "!" with bitwise NOT "~" for values 0 and 1.
  • 8.e9
    Print an original mask and its bitwise complement in hexadecimal.
  • 8.e10
    Use a complemented mask to disable selected machine-output bits.

8.f LEFT AND RIGHT SHIFT

BITWISE SHIFTS AND BITWISE BASICS
What is learned: LEFT AND RIGHT SHIFT
Why it matters: Bitwise operations directly control flags, registers, permissions, protocols, packed data, and embedded hardware pins.

  • 8.f1
    Shift "unsigned char" value 1 left from bit 0 through bit 7.
  • 8.f2
    Shift "unsigned int" value 1 left by 1, 4, 8, and 16 positions.
  • 8.f3
    Shift byte value 128 right until it becomes zero.
  • 8.f4
    Compare multiplication by 2 with a one-position left shift for safe small values.
  • 8.f5
    Compare division by 2 with a one-position right shift for positive integers.
  • 8.f6
    Build a mask for a user-selected bit position with "1u << position".
  • 8.f7
    Extract bits 4 through 7 from an "unsigned int" using shift and AND.
  • 8.f8
    Place a four-bit value into bits 8 through 11 using shift and OR.
  • 8.f9
    Combine two "unsigned char" values into one "unsigned int" word.
  • 8.f10
    Split one "unsigned int" word into high and low byte values.

8.g COMBINED BITWISE OPERATIONS

BITWISE SHIFTS AND BITWISE BASICS
What is learned: COMBINED BITWISE OPERATIONS
Why it matters: Bitwise operations directly control flags, registers, permissions, protocols, packed data, and embedded hardware pins.

  • 8.g1
    Set one bit, test it, toggle it, and clear it in sequence.
  • 8.g2
    Pack four Boolean input states into the first four bits of one byte.
  • 8.g3
    Unpack the first four bits of a byte into four printed ON or OFF states.
  • 8.g4
    Store an RGB332 color value by combining reduced red, green, and blue fields.
  • 8.g5
    Extract red, green, and blue fields from an RGB332 byte.
  • 8.g6
    Build a simple permission byte and test READ, WRITE, and EXECUTE flags.
  • 8.g7
    Compare two machine-state bytes and print changed bits.
  • 8.g8
    Copy selected bits from one integer into another using AND, NOT, and OR.
  • 8.g9
    Rotate an eight-bit value left by one position using shifts and OR.
  • 8.g10
    Make a console bit-tool that can set, clear, toggle, and test one selected bit.

9.a CONSOLE PRINTING BASICS

PRINTF AND OUTPUT FORMATTING
What is learned: CONSOLE PRINTING BASICS
Why it matters: Formatted output makes debugging, logs, diagnostics, measurements, and command-line tools readable.

  • 9.a1
    Print one integer with "%d".
  • 9.a2
    Print one unsigned integer with "%u".
  • 9.a3
    Print one float with "%.2f".
  • 9.a4
    Print one double with "%.4lf".
  • 9.a5
    Print one char with "%c" and its ASCII code with "%d".
  • 9.a6
    Print a table with columns: name, age, score.
  • 9.a7
    Print values aligned left and right using width specifiers.
  • 9.a8
    Print decimal, hexadecimal, and octal view of the same number.
  • 9.a9
    Print a simple invoice with item name, quantity, price, total.
  • 9.a10
    Print sensor values in one formatted line that looks like machine status output.

10.a SHORT REAL-WORLD EXERCISES

MIXED BASIC TASKS
What is learned: SHORT REAL-WORLD EXERCISES
Why it matters: Mixed exercises connect separate language rules into complete small programs and practical problem solving.

  • 10.a1
    Read device name as text idea only, then read id as int and print a summary line.
  • 10.a2
    Read voltage, current, and resistance values and print known electrical relations.
  • 10.a3
    Read PLC input byte value and print whether each first 4 bits is ON or OFF.
  • 10.a4
    Read motor runtime in seconds and print hours, minutes, seconds.
  • 10.a5
    Read tank width, length, height and print volume in liters.
  • 10.a6
    Read three exam scores and print average and pass/fail.
  • 10.a7
    Read one ASCII character and print next character in sequence.
  • 10.a8
    Read operator code as unsigned int and print if it is inside allowed range.
  • 10.a9
    Read analog value as double and print scaled engineering value.
  • 10.a10
    Build a mini console report that prints one row with id, name, value, and state.

13.a TYPE SIZE, RANGE, AND LIMITS

MORE BASIC C CATEGORIES TO ADD BEFORE DEEP TOPICS
What is learned: TYPE SIZE, RANGE, AND LIMITS
Why it matters: Sizes, limits, input checks, conversions, and precedence prevent data loss and difficult low-level bugs.

  • 13.a1
    sizeof char, int, float, and double
  • 13.a2
    CHAR_MIN and CHAR_MAX
  • 13.a3
    INT_MIN and INT_MAX
  • 13.a4
    UINT_MAX
  • 13.a5
    FLT_MIN and FLT_MAX
  • 13.a6
    DBL_MIN and DBL_MAX
  • 13.a7
    integer overflow observation
  • 13.a8
    unsigned wraparound observation
  • 13.a9
    float precision observation
  • 13.a10
    choose a suitable type for ten example values

13.b SCANF AND SAFE BASIC INPUT

MORE BASIC C CATEGORIES TO ADD BEFORE DEEP TOPICS
What is learned: SCANF AND SAFE BASIC INPUT
Why it matters: Sizes, limits, input checks, conversions, and precedence prevent data loss and difficult low-level bugs.

  • 13.b1
    read one int with "%d"
  • 13.b2
    read one unsigned int with "%u"
  • 13.b3
    read one float with "%f"
  • 13.b4
    read one double with "%lf"
  • 13.b5
    read one char with a leading space before "%c"
  • 13.b6
    read two integers in one line
  • 13.b7
    check the return value from scanf
  • 13.b8
    reject input when scanf does not read the expected value
  • 13.b9
    read a bounded word into a char array later after arrays are introduced
  • 13.b10
    build one input and output summary program

13.c TYPE CONVERSION AND CASTING

MORE BASIC C CATEGORIES TO ADD BEFORE DEEP TOPICS
What is learned: TYPE CONVERSION AND CASTING
Why it matters: Sizes, limits, input checks, conversions, and precedence prevent data loss and difficult low-level bugs.

  • 13.c1
    convert int to float
  • 13.c2
    compare integer division with floating-point division
  • 13.c3
    convert float to int and observe removed fractional part
  • 13.c4
    cast one operand before division
  • 13.c5
    convert char to integer ASCII code
  • 13.c6
    convert integer ASCII code to char
  • 13.c7
    convert unsigned char to unsigned int before printing arithmetic result
  • 13.c8
    compare implicit conversion and explicit cast
  • 13.c9
    calculate average without losing the fractional result
  • 13.c10
    identify which conversions may lose data

13.d OPERATOR PRECEDENCE AND EXPRESSIONS

MORE BASIC C CATEGORIES TO ADD BEFORE DEEP TOPICS
What is learned: OPERATOR PRECEDENCE AND EXPRESSIONS
Why it matters: Sizes, limits, input checks, conversions, and precedence prevent data loss and difficult low-level bugs.

  • 13.d1
    compare "a + b * c" with "(a + b) * c"
  • 13.d2
    combine subtraction and division
  • 13.d3
    combine modulo and addition
  • 13.d4
    compare pre-increment and post-increment in separate statements
  • 13.d5
    use parentheses to make calculation order explicit
  • 13.d6
    calculate a percentage expression correctly
  • 13.d7
    calculate Celsius to Fahrenheit with correct numeric types
  • 13.d8
    find and fix an expression with integer division error
  • 13.d9
    split one complex expression into named intermediate variables
  • 13.d10
    print every intermediate result of a mixed expression