



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
THIS DOC CONTAINS NOTES FOR INTRO TO C LANGUAGE WHICH INCLUDES WHAT IS COMPUTER ,HARDWARE,SOFTWARE , COMPONENTS OF COMPUTER,STRUCTURE OF C, HISTORY AND STEPS OF C , ERRORS AND THEIR TYPES ETC.MY NOTES IS EASY TO UNDERSTAND AND IS REASONABLE WITH THE PRICE. CHECK IT OUT .
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!
"Programming for Problem Solving” -Unit-1 Introduction to Programming
● Introduction to Computer System: ○ A computer is an electronic device made of hardware and software. 1
○ It takes input (data), processes it, stores intermediate and final data, and provides output (information). 2
○ A diagram illustrates the flow: Input -> Processor (CPU - Arithmetic Logic Unit, Control Unit) -> Storage Unit (Primary, Secondary) -> Output (Information). 3
○ Computer Hardware: Refers to the physical components like CPU and mouse that perform physical work. 4
○ Computer Software: Commands hardware on what and how to do tasks. 5
○ Components of Computer System (Major Tasks): Input, Process (calculations/operations), Control (transformation process), Storage (intermediate and final results), Provides Output (information). 6
○ Types of Software: System Software (e.g., Windows, Unix) and Application Software (e.g., MS Office programs, games, Paint, MS Word). ● Characteristics of Computer: ○ Speed: Dependent on CPU speed, calculated by instructions performed per second, measured in Hertz (Hz). 7
○ Accuracy/Correctness: Performs tasks accurately. Garbage Input leads to Garbage Output. 8
○ Automation: Once input is given, the computer automatically processes it to provide desired output. 9
○ Diligence: Computers don't get tired of repetitive tasks, performing them with the same accuracy and execution time. 10
○ Performs tasks with the same efficiency even if many are assigned. 11
○ Memory: Stores final and intermediate results. 12
● Operating System:
○ The primary goal is to make computer systems convenient and efficient. 13
○ Ensures efficient use of system resources like memory and I/O devices. 14
○ Important for an OS to have a control policy and algorithm to manage system resources, especially with multiple programs residing in memory. 15
○ Examples: Windows, Linux, Unix. 16
● Introduction to C Language: ○ A high-level programming language given by Dennis Ritchie in 1972 at Bell Labs, California, USA. 17
○ Popular because it is simple and easy to use. 18
○ Enables programmers to concentrate on problem-solving, not machine code. 19
○ Small in size, has 32 keywords. 20
○ Structured language: code can be organized using functions. 21
○ Makes efficient use of function calls. 22
○ Supports pointers, arrays, structures, unions. 23
○ A core language for many other programming languages like C++, Java. 24
● Steps in Learning C Language: ○ Similar to learning English (Alphabets -> Words -> Sentences -> Paragraphs). ○ C language elements: Digits (0-9), Alphabets (A-Z, a-z), Special Symbols (+, -, *, @, $, etc.). 25
○ Character Sets: Include digits (0-9), capital (A-Z) and small (a-z) characters. ○ Tokens: Basic building blocks in C, the smallest individual unit in a C program. (^26) Programs are constructed using combinations of tokens. 27 Examples:
int, a, ;, sum are all tokens. 28
○ Constants: Numerical digits that remain unchanged. 29 Cannot be null. 30 Can be single characters or strings.
○ Operators: Used to perform specific arithmetic operations or tasks (+, -, *, /). ○ Keywords: Reserved or predefined words with fixed meanings. C has 32 keywords (e.g., if, else, case). ○ Instructions: Set of commands given to the compiler. A program is a set of instructions. ○ Identifier: Helps identify data (variables, arrays, functions). Can consist of letters, numerals, or underscores. 31 Examples:
int sum = a + b;, int roll_no;. ● Types of Instructions in C Language: ○ Type Declaration Instruction: Declares the type of variable (e.g., int a = 0, 1, -1). 32
○ Arithmetic Instruction: Performs arithmetic operations, contains operators and operands (values on which operations are performed). 33 Example:
a = b + c;. 34
○ Control Instruction: Controls the execution sequence of statements (e.g., conditional statements, looping statements). 35
● Errors in Programming (Bugs): ○ Errors are problems or faults that make a program behave abnormally. ○ The process of removing bugs is "Debugging." 36
○ Errors are found by the compiler. 37
○ Types of Errors:^38
■ Syntax Error (Compile-time errors): Occur when rules of C programming are broken (e.g., missing semicolon). 39
■ Run-Time Error: Occur when the program is running, even after successful compilation. Often due to segmentation faults (programs trying to access unauthorized memory). 40 Example: Accessing
a[10] in an array declared as int array[5]. 41 This leads to abnormal behavior or garbage values. 42
■ Logical Error: Occur when syntax is correct, but the desired result is not achieved due to logical issues. 43 Example: