Unit 1: C Fundamentals.
Comprehensive study guide covering computer basics, algorithms, and core C syntax tailored for JNTUK R23 exams.
01. Topic Archive
Computer Overview
Functional units of computer, Input/Output devices, and basic memory organization.
Jump to Notes →Problem Solving
Algorithms, Flowcharts, and Pseudo-code construction. Guaranteed 7-mark question area.
Jump to Notes →C Language Syntax
Data types, Storage classes, Operators, and Input/Output functions in C.
Jump to Notes →02. Full Notes
Introduction to Computers
A computer is an electronic device that processes data according to set of instructions. In the context of JNTUK exams, you must remember the functional units:
- Input Unit: Devices like Keyboard, Mouse that help enter data.
- Central Processing Unit (CPU): The brain. Contains ALU (Arithmetic Logic Unit) and CU (Control Unit).
- Output Unit: Monitor, Printer displaying results.
- Memory Unit: Primary (RAM) and Secondary (Hard disk) storage.
Algorithm & Flowcharts
Algorithm: A step-by-step logical procedure to solve a problem. It should be finite, definite, and effective.
Flowchart: A pictorial representation of an algorithm. Use standard symbols:
Structure of a C Program
main() function where execution begins.
A standard C program follows this hierarchy, which is a common 5-mark question:
C Data Types
C is a statically typed language. Memorize this table:
| Type | Keyword | Size (16-bit) | Format |
|---|---|---|---|
| Integer | int | 2 Bytes | %d |
| Character | char | 1 Byte | %c |
| Floating Point | float | 4 Bytes | %f |
I. Advanced C Language Mechanics
A curated authoritative reference index covering compiler phases, storage classes, system busses, and logic control paradigms.
1. Functional Computer Hardware Architecture
A computer is an organized collection of functional units operating in mechanical harmony. The CPU orchestrates instructions by communicating with primary and secondary memory storage channels over electrical lines termed System Busses.
- Data Bus: Transports actual binary operand values between register files, CPU accumulators, and memory blocks. Its width (e.g., 32-bit or 64-bit) determines how many bits the system can fetch simultaneously.
- Address Bus: Carries the physical address coordinates of memory cells that the CPU wishes to read from or write to. A 32-bit address bus can access up to 4GB ($2^{32}$ locations) of memory space.
- Control Bus: Transmits timing signals, read/write commands, clock cycles, and interrupt signals to regulate hardware synchronization.
2. Life-Cycle of a C Source Code Execution
C is a compiled language. Solidifying your understanding of how human-written src.c converts into machine-runnable object.exe is critical for both university exams and system development.
- Preprocessing (Pre-compilation): Translates lines starting with
#(preprocessor directives). It expands macroscopic constants, copies header file definitions directly into the stream, and strips comments. Output:file.i. - Compilation: Syntactically parses the preprocessed stream, translating C statements into system-specific Assembly instructions (such as x86 or ARM assembly). Output:
file.s. - Assembly: Translates assembly-specific Mnemonics into raw binary MACHINE CODE instructions, creating relocatable object files. Output:
file.oorfile.obj. - Linking: Links object files with pre-compiled compiler libraries (like
stdio.hcode binaries) to resolve reference boundaries, yielding a unified runnable file. Output:file.exeor standard machine files.
3. Byte Representation & Complement Mathematics
How are characters, positive and negative integers, and fractional numbers stored inside memory blocks? JNTUK R23 curriculum demands mastery over these binary schemes.
Integer Sign Conventions
For signed data types, the Most Significant Bit (MSB) acts as the sign flag (0 = positive, 1 = negative). Negative integers are stored using **Two's Complement Representation**, as it simplifies CPU arithmetic logic by allowing addition and subtraction to use the same hardware path.
Step 1: Write positive 5 => 0000 0101
Step 2: One's Complement (flip bits) => 1111 1010
Step 3: Add 1 => 1111 1011 (This is -5 as a signed integer)
IEEE 754 Floating-Point Standard
Real and decimal values cannot be stored using standard sign flags. Under the IEEE 754 standard, single-precision floats (4 Bytes) partition their 32 bits into three logical components to balance range and precision:
Double-precision decimals utilize 64 bits total, devoting 1 bit to the sign, 11 bits to the exponent, and 52 bits to the mantissa to represent values with a higher degree of precision.
4. Variable Scope, Lifetime & Storage Classes
A storage class defines where a variable is stored (memory or CPU registers), its initial default values, its visibility scope, and its lifetime. This is a common 7-to-10 mark question in university exams.
| Storage Class | Location | Default Value | Scope | Lifetime |
|---|---|---|---|---|
| auto | RAM Memory | Garbage Value | Local (Block) | Dynamic (Exit of Block) |
| register | CPU Register | Garbage Value | Local (Block) | Dynamic (Exit of Block) |
| static | RAM Memory | Zero (0) | Local (Block) | Global (End of Program) |
| extern | RAM Memory | Zero (0) | Global (Multi-file) | Global (End of Program) |
5. Bitwise Operators & Truth Tables
Bitwise operators manipulate the individual bits of an operand directly. These operations are highly efficient and are commonly used in low-level driver development, data encryption, and performance optimization.
Output bit is set to 1 only if BOTH input bits are 1.
Output = 0001 (Decimal 1)
Output bit is set to 1 if AT LEAST ONE input bit is 1.
Output = 0111 (Decimal 7)
Output bit is set to 1 if the input bits are DIFFERENT.
Output = 0110 (Decimal 6)
6. High-Yield Code Walkthroughs (JNTUK Likely)
This section includes fully documented, standard C programs that are highly likely to appear on exam question papers, verified for R23 syllabus compliance.
Program A: Roots of Quadratic Equation
Handles imaginary, real, distinct, and single identical root conditions cleanly using <math.h>.
Program B: Multi-Action Arithmetic Calculator
Implements an interactive console calculator using the C switch control structure.
7. Preprocessor Directives & Macro Expansions
Lines that begin with # are direct instructions to the preprocessor (run before the compilation stage). This is another high-probability topic in JNTUK R23 exams.
- File Inclusion (
#include): Tells the preprocessor to replace this line with the entire raw text of the specified file (for example,<stdio.h>contains standard input/output prototypes). - Macro Definition (
#define): Instructs the preprocessor to replace all occurrences of a macro identifier with a given replacement pattern during preprocessing. - Conditional Compilation (
#ifdef,#ifndef,#endif): Allows sections of code to be compiled selectively based on whether a specific macro constant has been defined, representing an excellent way to maintain cross-platform codebases.
03. Cheat Sheet
Operators Shortcut
- Arithmetic + - * / %
- Relational > < >= <= == !=
- Logical && || !
- Assignment = += -= *=
- Special sizeof() & ,
Decision Making
Syntax for Switch statement (Common Question):
04. Exam PYQs
Q: Explain the different data types available in C language?
View Solved AnswerQ: Define Algorithm & Flowchart. Differentiate them with a simple example.
View Solved Answer06. Quick Revision
Memory Hack: Data Types
"Int is 2, Float is 4, Char is 1, Double is 8" (Bytes in 16-bit).
Operator Priority
P-U-A-R-L-A (Parenthesis, Unary, Arithmetic, Relational, Logical, Assignment).
1-Day Before Prep Pack
Must Solve Programs
- Largest of 3 numbers using nested-if
- Calculator using Switch case
- Roots of quadratic equation
Critical Theory
Algorithm vs Flowchart symbols (Draw accurately!)
Structure of C Program (Define all sections)
Quick Formulas
// Ternary Operator
(condition) ? true : false;
// Type Cast
(float)sum/count;
Weightage Analysis
Type Density Heatmap
Dense
Lite
Heavy
Hot
Ready for Unit 2?
Explore Full SubjectLogin via Dashboard to save your progress, secure your streak, and unlock AI features.