0% found this document useful (0 votes)
13 views5 pages

Comprog Reviewer

The document provides an overview of C programming, its history, and its significance in modern software development. It covers the origins of C, its features, and its influence on other programming languages, as well as fundamental concepts such as variable declaration, operators, and syntax rules. The document emphasizes the importance of C in system programming and its continued relevance today.

Uploaded by

JM Hiponia Jaem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Comprog Reviewer

The document provides an overview of C programming, its history, and its significance in modern software development. It covers the origins of C, its features, and its influence on other programming languages, as well as fundamental concepts such as variable declaration, operators, and syntax rules. The document emphasizes the importance of C in system programming and its continued relevance today.

Uploaded by

JM Hiponia Jaem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

WEEK 1

C programming is a foundational computer programming language that has had a significant impact on
modern software development.

Created by Dennis Ritchie at Bell Labs in 1972,

C was designed for system-level programming and has since become one of the most widely used and
influential programming languages.

computer is an electronic device that processes data according to a set of instructions called a program.
It performs various tasks, such as calculations, data processing, and communication, by executing these
instructions. Computers are capable of storing, retrieving, and manipulating large amounts of data
quickly and accurately, making them essential tools in many aspects of modern life.

Programming is the process of designing, writing, testing, and maintaining the code that instructs a
computer on how to perform specific tasks. This code is written in a programming language, which
consists of a set of rules and syntax that a computer can interpret and execute.

A program is a set of instructions written in a programming language that tells a computer how to
perform a specific task or solve a particular problem. When a program is executed, the computer follows
these instructions step by step to carry out the desired operations

Computer programming is the process of designing and building executable computer software to
accomplish a specific computing task. It involves writing code in a programming language, such as C++,
Python, or Java, to instruct the computer on what actions to perform. The primary activities in computer
programming include:

1. Problem Analysis: Understanding and defining the problem to be solved.

2. Algorithm Development: Creating a step-by-step procedure to solve the problem.

3. Coding: Writing the program in a specific programming language.

4. Testing and Debugging: Running the program to find and fix any errors.

5. Documentation: Writing detailed explanations of how the program works and how to use it.

6. Maintenance: Updating the program to fix issues or add new features as needed.

Computer programming is essential in creating applications, systems software, and embedded software
across various industries.

WEEK 2

Origins and Development:

Late 1960s: The development of the C language began in the late 1960s at Bell Laboratories (AT&T Bell
Labs) in the United States. It was created by Dennis Ritchie as a part of the UNIX operating system
project. The original intention was to develop a language that could be used for system programming on
the PDP-11, a popular minicomputer at the time.

Predecessors:

BCPL (1966): Developed by Martin Richards, BCPL (Basic Combined Programming Language) was a
precursor to C. It was a typeless language designed for writing operating systems and compilers.

B Language (1969): Developed by Ken Thompson, the B language was a simplification of BCPL,
specifically designed for use with the UNIX operating system. However, B was limited in terms of data
types and functionality.

2. Creation of C:

1972: Dennis Ritchie developed C by improving the B language, adding data types and other features to
make it more versatile for system programming. The C language retained the simplicity of B but
introduced key enhancements, such as the concept of data types (e.g., int, char) and a more
comprehensive set of operators.

C Language Features:

Portability: One of C's most significant features was its portability, meaning programs written in C could
be run on different types of machines with minimal modification. This was a major advantage in the era
of diverse computer architectures.

Efficiency: C was designed to provide low-level access to memory and hardware, making it highly
efficient for system-level programming. It allowed direct manipulation of hardware through pointers
and memory addresses.

3. C's Rise to Popularity:

UNIX and C:

The success of the UNIX operating system played a crucial role in popularizing C. UNIX was almost
entirely written in C, showcasing the language's power and flexibility. As UNIX spread across academic
and commercial institutions, so did the C language.

Standardization:

1978 - "The C Programming Language": Dennis Ritchie and Brian Kernighan published "The C
Programming Language," also known as "K&R C," which became the definitive guide to the language and
a de facto standard.

ANSI C (1989): The American National Standards Institute (ANSI) established a standard for C, known as
ANSI C or C89, to ensure consistency across different implementations of the language.

ISO C (1990): The International Organization for Standardization (ISO) adopted ANSI C, further solidifying
C as a globally recognized programming language standard.

4. C's Legacy and Influence:

C's influence on other languages:


C's syntax and structure influenced the development of many other programming languages, including
C++, Java, C#, and even more modern languages like Go and Rust. The C language laid the foundation for
many key concepts in programming, such as structured programming, memory management, and low-
level system access.

C Today:

Despite being over 50 years old, C remains widely used in system programming, embedded systems, and
high-performance applications. Its simplicity, efficiency, and flexibility continue to make it a popular
choice among programmers and software developers.

WEEK 3

Header Files: C programs often start with #include directives, which include header files containing
definitions and declarations for functions and macros used in the program. Example:

Main Function: Every C program must have a main() function, which serves as the entry point for
execution. Example:

Statements and Expressions: C statements are the instructions executed by the program, ending with a
semicolon (;). Expressions combine variables, operators, and function calls to produce a value.

Syntax Rules:

Case Sensitivity: C is case-sensitive, meaning that Variable and variable are considered different
identifiers.

Semicolons: Every statement in C must end with a semicolon.

Braces {}: Used to group statements into blocks, such as in function definitions and control structures.

Comments: Comments are used for documentation within the code. Single-line comments start with //,
and multi-line comments are enclosed between /* and */.

printf is short for print formatted where print refers to output to a printer although the functions are
not limited to printer output.

printf: Used to output formatted text to the console

scanf: Used to read formatted input from the user

return 0 means that the program will execute successfully and did what it was intended to do

WEEK 4

Variable Declaration:

Purpose: Declaring a variable means informing the compiler about the variable's name and the type of
data it will store. It reserves memory for that variable based on its data type.

A variable in C programming (and in most programming languages) is a symbolic name or identifier


associated with a memory location that stores data. This data can be changed during the execution of a
program, hence the term "variable." Variables allow programmers to store, retrieve, and manipulate
data in a flexible and dynamic way.

A variable is associated with a specific data type that determines the type of data it can hold

Key Concepts of a Variable:

Name (Identifier):

The variable is given a unique name (identifier) that is used to refer to the data stored in that memory
location. The name must follow specific rules (e.g., it cannot start with a number, and it must not be a
reserved keyword in C).

Rules for naming a variable

• A variable name can only have alphabets, numbers and the underscore _.

• A variable name cannot begin with a number.

• A Variable names cannot begin with an uppercase character.

• A variable name cannot be a keyword. For example, int is a keyword that is used to denote
integers.

• A variable name can start with an underscore. However, it's not considered a good practice.

• Names can contain letters, digits and underscores

• Names are case-sensitive (myVar and myvar are different variables)

• Names cannot contain whitespaces or special characters like !, #, %, etc.

• Reserved words (like C keywords, such as int) cannot be used as names

Note: We should try to give meaningful names to variables. For example, first_name is a better variable
name than fn.

Specifiers are keywords used to modify the behavior or characteristics of data types, variables,
functions, or other elements in a program. They provide additional information about how the data
should be interpreted, stored, or accessed. Specifiers play a crucial role in controlling the memory
allocation, size, scope, and functionality of variables and functions.

Format Specifiers:

Used in functions like printf() and scanf() to specify the type of data to be printed or read.

Examples:

%d or %i: Integer

%f: Floating-point number

%c: Character
%s: String (array of characters)

%lf: Double

Variable Types

Names description Specifiers:

int whole numbers %d

float Floating-point numbers %f

double Double-precision floating-point numbers %fl

char Single characters %c/%s

WEEK 5

Operators are fundamental elements in programming languages, including C, that perform operations
on data values. They play a crucial role in developing algorithms, performing calculations, and
controlling the flow of a program. Here's why operators are so important:

1. Data Manipulation and Calculations:

o Operators allow for the manipulation and computation of data. Arithmetic operators (+, -, *, /,
%) enable basic mathematical operations necessary for solving equations, performing statistical analysis,
and handling numeric data. For example, they are used to calculate the total price of items, determine
averages, or compute financial projections.

Arithmetic Operators: Used for performing basic mathematical operations.

Addition (+): Adds two operands (e.g., a + b).

Subtraction (-): Subtracts the second operand from the first (e.g., a - b).

Multiplication (*): Multiplies two operands (e.g., a * b).

Division (/): Divides the first operand by the second (e.g., a / b).

Modulus (%): Finds the remainder of the division (e.g., a % b).

Increment (++): Increases the value by 1.

Decrement (--): Decreases the value by 1.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy