Quiz: Basics | Variables | Data Types
Quiz: Basics | Variables | Data Types checks how well you can apply Valid vs invalid identifiers and Size of int and char on your system (and related ideas) in C.
Introduction
Quiz: Basics | Variables | Data Types checks how well you can apply Valid vs invalid identifiers and Size of int and char on your system (and related ideas) in C. Try each prompt in a scratch file before moving on.
Understanding the topic
Challenge 1 In your own words — or with a tiny program — show that you understand: Valid vs invalid identifiers.
Challenge 2 In your own words — or with a tiny program — show that you understand: Size of int and char on your system.
Challenge 3 In your own words — or with a tiny program — show that you understand: Difference between declaration and initialization.
Challenge 4 In your own words — or with a tiny program — show that you understand: Correct format specifiers for float and double.
- Challenge 1 — In your own words — or with a tiny program — show that you understand: Valid vs invalid identifiers.
- Challenge 2 — In your own words — or with a tiny program — show that you understand: Size of int and char on your system.
- Challenge 3 — In your own words — or with a tiny program — show that you understand: Difference between declaration and initialization.
- Challenge 4 — In your own words — or with a tiny program — show that you understand: Correct format specifiers for float and double.
Step-by-step explanation
- Challenge 1 — In your own words — or with a tiny program — show that you understand: Valid vs invalid identifiers.
- Challenge 2 — In your own words — or with a tiny program — show that you understand: Size of int and char on your system.
- Challenge 3 — In your own words — or with a tiny program — show that you understand: Difference between declaration and initialization.
- Challenge 4 — In your own words — or with a tiny program — show that you understand: Correct format specifiers for float and double.
Execution workflow
Challenge 1
In your own words — or with a tiny program — show that you understand: Valid vs invalid identifiers.
Best practices
- Enable warnings: gcc -Wall -Wextra -std=c11 source.c -o app
- Give every variable a defined value before it is read.
- Stay inside array bounds — C will not stop you from over-running a buffer.
Common mistakes
- Reading uninitialized storage — behavior is undefined.
- Dismissing compiler warnings instead of fixing root causes.
- Ignoring NULL returns from malloc, fopen, and similar APIs.
Hands-on exercise
Practice problems:
- Build or explain: Valid vs invalid identifiers
- Build or explain: Size of int and char on your system
- Build or explain: Difference between declaration and initialization
- Build or explain: Correct format specifiers for float and double
Summary
Quiz: Basics | Variables | Data Types in C — Self-check on declarations, types, and naming.