This document provides an overview of programming concepts like algorithms, flowcharts, pseudocode, and the C programming language. It discusses topics such as programming, variables, data types, input/output functions, and more. Code samples and definitions are provided to illustrate key concepts in learning to program.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, preprocessing directives, and how to compile and execute a C program.
This document introduces C programming and provides an overview of programming languages. It discusses that programming languages can be categorized into machine language, assembly language, and high-level languages. C programming is then introduced, including that it was developed in 1970, standardized in 1989, and used to develop UNIX. The basic structure of a C program is outlined including the documentation, link, definition, main, and subprogram sections.
84 identify group keys on the keyboard and their functionsPaul Gonzales
The document provides information about the keys on a computer keyboard and their functions. It discusses the main types of keys including alphanumeric keys for typing letters and numbers, arrow keys for navigating, function keys for performing commands, and special keys like Enter, Esc, Tab, Shift, Ctrl and Alt. It also describes the purpose and use of keys like Caps Lock, space bar, backspace, delete, page up/down, numeric keypad, print screen, and scroll lock.
This document provides an overview of the typical configuration of a computer system. It discusses the main components including the input unit, central processing unit (CPU), memory unit, and output unit. The CPU contains the control unit and arithmetic logic unit. The memory unit includes both primary storage like RAM and secondary storage. The document then discusses the motherboard in more detail, including its components like the processor, BIOS, slots, disk controllers, ports, and bus. It describes the different types of motherboard including XT, AT, baby AT, and ATX. Finally, it discusses the primary and secondary memory in a computer system.
This document summarizes computer hardware components. It divides hardware into three main groups: input devices, output devices, and the system unit. Input devices like keyboards and mice are used to enter data, while output devices like monitors and printers display or print data. The system unit contains the central processing unit and memory that process data, as well as peripheral components like the motherboard, hard disk drive, ports and power supply.
This document provides an overview of the C programming language. It begins with an outline of topics covered, then defines C as a structured, high-level, machine-independent language that follows a top-down approach. The document traces the history and evolution of C from earlier languages like ALGOL and BCPL. It describes key features of C like portability, speed, and simplicity. It also explains the roles of compilers and linkers and includes flowcharts, sample programs, and discussions of variables, data types, operators, and control statements in C like if/else statements and switch cases.
The document discusses various control structures in C++ like conditional statements (if-else, switch), loops (while, for, do-while), and jump statements (break, continue, goto). It provides examples to explain if-else, switch, while, for, do-while loops. Nested loops and break/continue statements are also covered. The last section briefly explains unconditional jump with goto statement.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, preprocessing directives, and how to compile and execute a C program.
This document introduces C programming and provides an overview of programming languages. It discusses that programming languages can be categorized into machine language, assembly language, and high-level languages. C programming is then introduced, including that it was developed in 1970, standardized in 1989, and used to develop UNIX. The basic structure of a C program is outlined including the documentation, link, definition, main, and subprogram sections.
84 identify group keys on the keyboard and their functionsPaul Gonzales
The document provides information about the keys on a computer keyboard and their functions. It discusses the main types of keys including alphanumeric keys for typing letters and numbers, arrow keys for navigating, function keys for performing commands, and special keys like Enter, Esc, Tab, Shift, Ctrl and Alt. It also describes the purpose and use of keys like Caps Lock, space bar, backspace, delete, page up/down, numeric keypad, print screen, and scroll lock.
This document provides an overview of the typical configuration of a computer system. It discusses the main components including the input unit, central processing unit (CPU), memory unit, and output unit. The CPU contains the control unit and arithmetic logic unit. The memory unit includes both primary storage like RAM and secondary storage. The document then discusses the motherboard in more detail, including its components like the processor, BIOS, slots, disk controllers, ports, and bus. It describes the different types of motherboard including XT, AT, baby AT, and ATX. Finally, it discusses the primary and secondary memory in a computer system.
This document summarizes computer hardware components. It divides hardware into three main groups: input devices, output devices, and the system unit. Input devices like keyboards and mice are used to enter data, while output devices like monitors and printers display or print data. The system unit contains the central processing unit and memory that process data, as well as peripheral components like the motherboard, hard disk drive, ports and power supply.
This document provides an overview of the C programming language. It begins with an outline of topics covered, then defines C as a structured, high-level, machine-independent language that follows a top-down approach. The document traces the history and evolution of C from earlier languages like ALGOL and BCPL. It describes key features of C like portability, speed, and simplicity. It also explains the roles of compilers and linkers and includes flowcharts, sample programs, and discussions of variables, data types, operators, and control statements in C like if/else statements and switch cases.
The document discusses various control structures in C++ like conditional statements (if-else, switch), loops (while, for, do-while), and jump statements (break, continue, goto). It provides examples to explain if-else, switch, while, for, do-while loops. Nested loops and break/continue statements are also covered. The last section briefly explains unconditional jump with goto statement.
This document provides an introduction to basic computer concepts. It discusses what computers are and their main components, including hardware such as the system unit, motherboard, CPU, memory and storage devices. It also discusses software and different types of computer programs. The document explains how computers represent and store various types of data like text, images, and files in binary form. It highlights some key advantages of computers like speed, reliability, storage and communications capabilities.
1) C structures allow the grouping of related data items and treat the structure as a single scalar unit that can be passed to functions or assigned to variables.
2) Structures can contain other structures as members through pointers, allowing recursive definitions. However, one structure must be declared in incomplete form before the other refers to it.
3) Unions allow different types of data to occupy the same memory location, with the type indicated through an accompanying enum variable. The size of a union is that of its largest member.
Laptops, netbooks, and palmtop/PDAs are more portable than desktop computers but have less power and storage capacity. Recent developments in ICT include cloud computing, which allows access to software and data storage over the Internet, and e-books, which can store thousands of books digitally but may cause eye strain.
This document discusses pointers in C++. It begins by defining pointers as variables that hold the memory addresses of other variables and explaining that pointers have types corresponding to the types of variables they point to. It then covers initializing and dereferencing pointers, constant pointers, pointer arithmetic, pointers and arrays, using pointers as function arguments, and memory management using pointers with the new and delete operators.
THE COMPUTER MOTHERBOARD AND ITS COMPONENTSAqsa Mushtaq
The motherboard is the main circuit board in a computer that holds many crucial components like the CPU and memory. It provides connections for peripherals and contains components like the CPU socket, memory slots, and chipset. The motherboard also includes power connectors and expansion slots to connect graphics cards and other devices, as well as ports on the back panel for connecting external devices.
The document introduces Python IDLE and basic Python syntax. It discusses that Python is an interpreter that reads and executes code. It also covers Python keywords like print, keywords being case sensitive, using quotation marks in strings, variables reserving memory locations, and statements being expressions read and executed by the interpreter.
This document provides an overview of mass storage systems and disk management techniques. It discusses disk structure, performance characteristics, scheduling algorithms like FCFS, SSTF, SCAN, C-SCAN and C-LOOK. It also covers disk attachment methods, storage arrays, storage area networks, solid-state disks, magnetic tape and swap space management. The goal is to describe physical structures, performance, scheduling and operating system services for mass storage devices.
Python is a widely-used and powerful computer programming language that has helped system administrators manage computer networks and problem solve computer systems for decades. Python has also built some popular applications like BitTorrent, Blender, Calibre, Dropbox, and much more. Going further, the “Pi” in Raspberry Pi stands for Python, so learning Python will instill more confidence when working with Raspberry Pi projects. Python is usually the first programming language people learn primarily because it is easy to learn and provides a solid foundation to learn other computer programming languages. In this webinar,
• Learn what Python is and what it is capable of doing.
• Install Python’s IDE for Windows and work in the Python shell.
• Use calculations, variables, strings, lists, and if statements.
• Discover Python’s built-in functions and understand modules.
• Create simple programs to build on later.
The recording is available at https://youtu.be/ThcWmJFf-ho.
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
The document discusses pointers in C programming. It defines pointers as variables that store memory addresses and can point to data of various types, such as integers, characters, arrays, functions, and other pointers. It explains how to declare pointers, dereference pointers to access data, use pointers as function arguments, perform arithmetic on pointers, and use pointers to structures. Pointers allow accessing data indirectly through memory addresses, provide flexibility in passing arguments to functions, and are fundamental to working with arrays and structures in C.
Hello there, this powerpoint presentation is made by Ansh kashyap(me) the topic of this presentation is "Data types in C".
Data types used in C language refer to an extensive system that we use to declare various types of functions or variables in a program. Here, on the basis of the type of variable present in a program, we determine the space that it occupies in storage, along with the way in which the stored bit pattern will be interpreted.
A data type specifies the type of data that a variable can store such as integer, floating, character, etc.
This document provides an overview of many common keyboard shortcuts across different operating systems and applications. It discusses shortcuts for Windows, MacOS, Linux, Internet Explorer/Mozilla Firefox, Microsoft Office applications like Excel, Word, Outlook and more. It also provides tips on how to create custom keyboard shortcuts for programs and applications. The document serves as a useful reference guide for many essential keyboard shortcuts.
STRING BASICS
DECLARING AND INITIALIZING
POINTERS FOR STRING MANIPULATION
STRING HANDLING FUNCTIONS: https://onlinegdb.com/zaPP6-oMS
CHARACTER ORIENTED FUNCTIONS : https://onlinegdb.com/pp7DrUBRlc
TWO DIMENSIONAL ARRAY OF STRINGS
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to be used for the UNIX operating system. The document then covers some key characteristics of C including that it is a structured, low-level programming language. It also lists some common features of C like simple syntax, rich libraries, and pointers. The document concludes with examples of basic C programs and descriptions of input/output functions and escape sequences.
1. The document discusses pointers in C including declaring and initializing pointer variables, pointer operators like & and *, calling functions by reference using pointers, pointer arithmetic, and the relationship between pointers and arrays.
2. Key topics covered include using pointers to simulate call-by-reference, dereferencing pointers with *, taking addresses of variables with &, and implementing a bubble sort using pointers passed as arguments.
3. Pointer arithmetic allows incrementing, decrementing, adding/subtracting integers to pointers, and comparing pointers.
The document discusses different types of motherboards, including non-integrated, integrated, desktop, laptop, and server motherboards. It describes the key components of a motherboard, such as the processor socket, chipset, memory sockets, BIOS chip, expansion slots, and input/output ports. Motherboards connect and allow communication between the various components and devices in a computer system.
detailed information about Pointers in c languagegourav kottawar
This document discusses pointers in C programming. It begins with an introduction to pointers and memory organization. It then covers basics of pointers including declaration, initialization, dereferencing, and pointer expressions. The document discusses various pointer applications including pointer arithmetic, pointers to pointers, dynamic memory allocation, pointers and arrays, and character strings. It provides examples to illustrate concepts like pointer expressions and pointer arithmetic with arrays. The document is intended as a reference for understanding pointers in C.
The document provides an overview of pointers in C programming. It defines pointers as variables that contain the address of another variable in memory. The document outlines various pointer operations such as dereferencing with *, address of with &, arithmetic, comparisons, NULL pointers, function pointers, pointers to arrays, arrays of pointers, and pointers to pointers. It provides examples to illustrate how to declare, initialize, and manipulate pointers in C code.
Data structure & Algorithms - Programming in Cbabuk110
This document discusses programming in C and primitive data types. It covers background on C, the structure of a C program, comments, identifiers, variables, constants, data types, primitive data types like integer, float, void, and the sizeof operator to check the size of data types. It provides examples of variable declarations, constants, escape sequences, and using sizeof.
The document provides an introduction to programming fundamentals in C++, including basic syntax and components of a C++ program. It covers variables and data types, input/output, comments, and how to write a simple C++ program with preprocessor directives and a main function. The key topics discussed are variable declaration, fundamental data types like int, float, char, comments, and how to write a basic "Hello World" program in C++.
This document provides an introduction to basic computer concepts. It discusses what computers are and their main components, including hardware such as the system unit, motherboard, CPU, memory and storage devices. It also discusses software and different types of computer programs. The document explains how computers represent and store various types of data like text, images, and files in binary form. It highlights some key advantages of computers like speed, reliability, storage and communications capabilities.
1) C structures allow the grouping of related data items and treat the structure as a single scalar unit that can be passed to functions or assigned to variables.
2) Structures can contain other structures as members through pointers, allowing recursive definitions. However, one structure must be declared in incomplete form before the other refers to it.
3) Unions allow different types of data to occupy the same memory location, with the type indicated through an accompanying enum variable. The size of a union is that of its largest member.
Laptops, netbooks, and palmtop/PDAs are more portable than desktop computers but have less power and storage capacity. Recent developments in ICT include cloud computing, which allows access to software and data storage over the Internet, and e-books, which can store thousands of books digitally but may cause eye strain.
This document discusses pointers in C++. It begins by defining pointers as variables that hold the memory addresses of other variables and explaining that pointers have types corresponding to the types of variables they point to. It then covers initializing and dereferencing pointers, constant pointers, pointer arithmetic, pointers and arrays, using pointers as function arguments, and memory management using pointers with the new and delete operators.
THE COMPUTER MOTHERBOARD AND ITS COMPONENTSAqsa Mushtaq
The motherboard is the main circuit board in a computer that holds many crucial components like the CPU and memory. It provides connections for peripherals and contains components like the CPU socket, memory slots, and chipset. The motherboard also includes power connectors and expansion slots to connect graphics cards and other devices, as well as ports on the back panel for connecting external devices.
The document introduces Python IDLE and basic Python syntax. It discusses that Python is an interpreter that reads and executes code. It also covers Python keywords like print, keywords being case sensitive, using quotation marks in strings, variables reserving memory locations, and statements being expressions read and executed by the interpreter.
This document provides an overview of mass storage systems and disk management techniques. It discusses disk structure, performance characteristics, scheduling algorithms like FCFS, SSTF, SCAN, C-SCAN and C-LOOK. It also covers disk attachment methods, storage arrays, storage area networks, solid-state disks, magnetic tape and swap space management. The goal is to describe physical structures, performance, scheduling and operating system services for mass storage devices.
Python is a widely-used and powerful computer programming language that has helped system administrators manage computer networks and problem solve computer systems for decades. Python has also built some popular applications like BitTorrent, Blender, Calibre, Dropbox, and much more. Going further, the “Pi” in Raspberry Pi stands for Python, so learning Python will instill more confidence when working with Raspberry Pi projects. Python is usually the first programming language people learn primarily because it is easy to learn and provides a solid foundation to learn other computer programming languages. In this webinar,
• Learn what Python is and what it is capable of doing.
• Install Python’s IDE for Windows and work in the Python shell.
• Use calculations, variables, strings, lists, and if statements.
• Discover Python’s built-in functions and understand modules.
• Create simple programs to build on later.
The recording is available at https://youtu.be/ThcWmJFf-ho.
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
The document discusses pointers in C programming. It defines pointers as variables that store memory addresses and can point to data of various types, such as integers, characters, arrays, functions, and other pointers. It explains how to declare pointers, dereference pointers to access data, use pointers as function arguments, perform arithmetic on pointers, and use pointers to structures. Pointers allow accessing data indirectly through memory addresses, provide flexibility in passing arguments to functions, and are fundamental to working with arrays and structures in C.
Hello there, this powerpoint presentation is made by Ansh kashyap(me) the topic of this presentation is "Data types in C".
Data types used in C language refer to an extensive system that we use to declare various types of functions or variables in a program. Here, on the basis of the type of variable present in a program, we determine the space that it occupies in storage, along with the way in which the stored bit pattern will be interpreted.
A data type specifies the type of data that a variable can store such as integer, floating, character, etc.
This document provides an overview of many common keyboard shortcuts across different operating systems and applications. It discusses shortcuts for Windows, MacOS, Linux, Internet Explorer/Mozilla Firefox, Microsoft Office applications like Excel, Word, Outlook and more. It also provides tips on how to create custom keyboard shortcuts for programs and applications. The document serves as a useful reference guide for many essential keyboard shortcuts.
STRING BASICS
DECLARING AND INITIALIZING
POINTERS FOR STRING MANIPULATION
STRING HANDLING FUNCTIONS: https://onlinegdb.com/zaPP6-oMS
CHARACTER ORIENTED FUNCTIONS : https://onlinegdb.com/pp7DrUBRlc
TWO DIMENSIONAL ARRAY OF STRINGS
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to be used for the UNIX operating system. The document then covers some key characteristics of C including that it is a structured, low-level programming language. It also lists some common features of C like simple syntax, rich libraries, and pointers. The document concludes with examples of basic C programs and descriptions of input/output functions and escape sequences.
1. The document discusses pointers in C including declaring and initializing pointer variables, pointer operators like & and *, calling functions by reference using pointers, pointer arithmetic, and the relationship between pointers and arrays.
2. Key topics covered include using pointers to simulate call-by-reference, dereferencing pointers with *, taking addresses of variables with &, and implementing a bubble sort using pointers passed as arguments.
3. Pointer arithmetic allows incrementing, decrementing, adding/subtracting integers to pointers, and comparing pointers.
The document discusses different types of motherboards, including non-integrated, integrated, desktop, laptop, and server motherboards. It describes the key components of a motherboard, such as the processor socket, chipset, memory sockets, BIOS chip, expansion slots, and input/output ports. Motherboards connect and allow communication between the various components and devices in a computer system.
detailed information about Pointers in c languagegourav kottawar
This document discusses pointers in C programming. It begins with an introduction to pointers and memory organization. It then covers basics of pointers including declaration, initialization, dereferencing, and pointer expressions. The document discusses various pointer applications including pointer arithmetic, pointers to pointers, dynamic memory allocation, pointers and arrays, and character strings. It provides examples to illustrate concepts like pointer expressions and pointer arithmetic with arrays. The document is intended as a reference for understanding pointers in C.
The document provides an overview of pointers in C programming. It defines pointers as variables that contain the address of another variable in memory. The document outlines various pointer operations such as dereferencing with *, address of with &, arithmetic, comparisons, NULL pointers, function pointers, pointers to arrays, arrays of pointers, and pointers to pointers. It provides examples to illustrate how to declare, initialize, and manipulate pointers in C code.
Data structure & Algorithms - Programming in Cbabuk110
This document discusses programming in C and primitive data types. It covers background on C, the structure of a C program, comments, identifiers, variables, constants, data types, primitive data types like integer, float, void, and the sizeof operator to check the size of data types. It provides examples of variable declarations, constants, escape sequences, and using sizeof.
The document provides an introduction to programming fundamentals in C++, including basic syntax and components of a C++ program. It covers variables and data types, input/output, comments, and how to write a simple C++ program with preprocessor directives and a main function. The key topics discussed are variable declaration, fundamental data types like int, float, char, comments, and how to write a basic "Hello World" program in C++.
This document provides an overview of basic C programming concepts including keywords, identifiers, character sets, data types, variables, operators, and control flow statements. Specifically, it discusses:
- Keywords and identifiers in C and rules for naming them.
- The character set used in C including alphabets, digits, and special characters.
- Basic and derived data types such as int, char, float, arrays, pointers, structures, unions, enums, and void.
- Types of variables like local, global, static, automatic, and external.
- Operators in C including unary, binary, ternary, arithmetic, relational, logical, and bitwise operators.
- Control flow statements
C is a general-purpose programming language initially developed for system development like operating systems. It produces efficient code nearly as fast as assembly language. The document provides an overview of basic C programming concepts including data types, variables, functions, arrays, structures, pointers, strings, input/output operations, and preprocessor directives. It also gives examples of basic "Hello World" program structure and syntax.
C Programming Lecture 3 - Elements of C.pptxMurali M
CENTURION UNIVERSITY OF TECHNOLOGY AND MANAGEMENT
ANDHRAPRADESH
SUBJECT NAME: (FULL NAME)
SUBJECT CODE: CUTM1046
MODULE NO:
S.No WRT
1 Explain in detail about intrinsic and extrinsic semiconductors with neat diagrams. 8
2 Explain about PN junction diode operation and draw V-I characteristics. 8
3 Derive PN junction diode current equation. 8
4 Explain about carrier concentration of fully injected light illumination on semiconductor bar and 8
5 What is hall effect ??, derive hall coefficient by drawing neat diagram and write the applications of it. 8
6 Explain about Zener diode and avalanche breakdown in detail. 8
7 Design all the logic gates using diodes and explain the operation with truth tables. 8
8 Draw half wave rectifier circuit, explain its operation and explain all the parameters of half wave rectifier. 8
9 Draw full wave rectifier circuit, explain its operation and explain all the parameters of full wave rectifier. 8
10 Draw energy band diagrams of PN junction diode and define diffusion length and life time of the carrier. 8
11 Explain about half wave rectifier 4
12 Explain about full wave rectifier 4
13 Explain PN junction characteristics 4
14 Explain about Light Emitting Diode 4
15 Explain Zener diode characteristics 4
16 i) Define ionic bond and covalent bond
ii) Explain intrinsic semiconductors 4
17 Explain about extrinsic semiconductor 4
18 Explain about hall effect in detail 4
19 Draw AND and OR logic gates using Diodes 4
20 Draw energy band diagram of PN junction diode. 4
This document provides an overview of the Structured Programming Language course offered at Notre Dame University in Bangladesh. The course covers topics such as programming language definition, the history of the C programming language, flow charts, pseudo code, control structures, decision making, operators, data types, variables, constants, and identifiers. It is presented by Stein Joachim Rebeiro, Zubayer Farazi, and Raisa Fabiha for Professor Abul Hasnat Md. Saiful Islam's Computer Science department.
This document provides an overview of the basics of the C programming language, including its character set, tokens, symbolic constants, and data types. The character set of C consists of letters, digits, whitespace, and special symbols. The smallest units of a C program are tokens, which include keywords, identifiers, constants, operators, strings, and special symbols. Symbolic constants are user-defined names for fixed values, defined using the #define preprocessor directive. C supports primary, derived, and user-defined data types, including integer, floating-point, character, and other types that specify the size and range of variable values.
C was developed by Dennis Ritchie at Bell Labs in 1972. It is a structured, portable, middle-level programming language that uses a top-down approach. A C program consists of functions, with one function named main serving as the starting point. C programs can include comments, preprocessor directives, variables, constants, data types and expressions connected with operators.
Programming for Problem Solving Unit 2Dhiviya Rose
This document discusses various topics related to C programming including variables, data types, operators, functions, and program structure. It begins with an introduction to variables and data types in C like integer, float, char etc. It then covers various operators used in C for arithmetic, relational, logical, and bitwise operations. The document also discusses constants, global and local variables. It explains function structure in C including function declaration, definition, and calls. Finally, it provides an overview of the C program compilation process.
1) The document provides an overview of C++ basics including variables, data types, input/output, arithmetic operators, and comments. It discusses variable naming, declarations, initialization, and assignment.
2) Key data types discussed include integers, floating-point numbers, characters, Booleans, and strings. The string class allows strings to be manipulated similarly to other data types.
3) Input is handled with cin and output with cout. Escape sequences can be used to control formatting. Arithmetic operators allow expressions to be formed. Comments start with // and /* */.
This document provides an overview of C++ programming and processing a C++ program. It discusses the evolution of programming languages and how a C++ program is compiled from source code to machine code. The document also explains that a C++ program is run by using an editor to create source code, preprocessing it, compiling it to create an object program, linking the object program, loading the executable code into memory, and executing it.
This document provides an overview of data types in C programming, including:
1) It describes four main types of data types - fundamental, modifiers, derived, and user defined. Fundamental types include integer, character, float, void. Modifiers change properties of other types. Derived types include arrays and pointers.
2) It explains the integer, float, character, and void fundamental data types in more detail. Integer can be short, int, long. Float and double store numbers in mantissa and exponent. Character represents keyboard characters.
3) Common C data type sizes and value ranges are provided for integer, float, and character types along with their modifiers like short, long, signed, unsigned.
Overview:
C is a general-purpose computer programming language created in the 1970s by Dennis Ritchie.
It remains widely used and influential due to its clean reflection of CPU capabilities.
Originally developed at Bell Labs, it was applied to re-implement the kernel of the Unix operating system.
C is commonly used on computer architectures ranging from the largest supercomputers to the smallest microcontrollers and embedded systems.
Features and Characteristics:
Imperative Procedural Language: C follows a procedural paradigm, emphasizing step-by-step instructions.
Structured Programming: Programs are divided into modules, making testing, maintenance, and debugging easier.
Low-Level Access to Memory: C provides direct memory manipulation.
Static Type System: Type checking is done at compile time.
Recursion Support: Functions can call themselves.
Cross-Platform Capability: C compilers are available for various architectures and operating systems.
Applications:
Operating Systems: C is widely used in OS development.
Device Drivers: C is essential for hardware interaction.
Protocol Stacks: Networking protocols are often implemented in C.
Embedded Systems: C is popular for microcontrollers and firmware.
Utilities and Tools: Many system utilities are written in C.
History:
ALGOL: The base language for C, introduced in 1960.
BCPL: Developed in 1967 for system software.
B: Created by Ken Thompson in 1970, influenced by BCPL.
C: Developed by Dennis Ritchie in 1972, combining features from ALGOL, BCPL, and B.
Standardization: ANSI and ISO standardized C in 1989.
Example “Hello, World!” Program:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
This simple program prints “Hello, World!” to the screen using the printf() function from the standard input-output library.
Remember, C’s legacy extends beyond application software, making it a foundational language for understanding programming concepts and system-level development.C is a general-purpose programming language that was developed in the early 1970s by Dennis Ritchie at Bell Laboratories. It is known for its efficiency and is widely used for system programming, including developing operating systems like UNIX. C is a procedural language, which means it follows a set of instructions step by step to perform a task. It allows low-level access to memory and provides a clean and simple syntax, making it a fundamental language in the field of computer science.These tags cover various aspects of C programming, from its use in system programming and embedded systems to its importance in learning coding fundamentals. Feel free to use these tags on social media platforms, blog posts, or other content related to C programming!
This presentation contain detail information about C language and its tokens such as Variables, data types, constant, operators, punctuator/separator , keywords . please do comment for your feedback or suggestions.
The document discusses data types in C programming. It covers the basic data types like int, float, char, etc. It also discusses variables, constants, keywords, operators and functions in C. The document provides examples of integer, real and character constants. It explains variable naming rules and different data types supported in C like char, short, int, float, double etc along with their sizes and ranges. It also provides a simple "Hello World" example C program.
At the end of this lecture students should be able to;
Define Keywords / Reserve Words in C programming language.
Define Identifiers, Variable, Data Types, Constants and statements in C Programming language.
Justify the internal process with respect to the variable declaration and initialization.
Apply Variable Declaration and Variable initialization statement.
Assigning values to variables.
Apply taught concepts for writing programs.
The document discusses the C programming language. It begins by providing an overview of the history and development of C, originating from earlier languages like ALGOL and BCPL. It then covers basic C concepts like data types, variables, constants, and user-defined types. Examples are given to declare and assign values to variables of different types. The document also discusses defining symbolic constants and reading input from the keyboard. Finally, it introduces the topic of operators and expressions in C.
Data types in C include integer, long, short, char, and double. Integer types can be signed or unsigned and their range depends on whether the compiler is 16-bit or 32-bit. Char requires 1 byte and represents a character with a range of -128 to 127. Double occupies 8 bytes with a range of -1.7e308 to +1.7e308 and is used to store floating point numbers. The document also provides examples of declaring different data types and their format specifiers used in scanf and printf statements.
This document discusses basic program elements in C++, including:
1. Initializing variables can be done in two ways - by appending an equal sign followed by the value (int a = 0), or by enclosing the value in parentheses (int a(0)). Both methods are valid in C++.
2. Variables can have either local or global scope - local variables are declared within a function while global variables are declared outside all functions.
3. Keywords are reserved words in C++ that have special meaning and cannot be used as regular identifiers. Common keywords include int, float, if, else, while, etc.
The document provides information on fundamental C data types including bits, bytes, words, integers, floating point numbers, enumerated types, variables, type conversions, constants, and basic operators. It defines common data types like char, int, float, and double. It also covers typecasting, variable declaration, and basic arithmetic, logical, relational, and bitwise operators.
This document discusses various mechanical material properties that are important for engineering applications. It begins with an introduction that defines mechanical properties as how materials react to loads or external forces. It then lists and describes key mechanical properties including yield strength, tensile strength, brittleness, ductility, stiffness, Poisson's ratio, hardness, thermal expansion, wear resistance, malleability, toughness, resilience, and creep. For each property, it provides details on the definition, types if applicable, and relevance for engineering design. The document concludes with references.
The document provides details about the tool room section of a metal and steel factory. It discusses the key functions of a tool room, which include tool storage, inventory management, maintenance, issue and return of tools, repair and modification of tools, calibration, and development of new tools. It also describes some of the main machines used in the tool room section, including a manual lathe machine which uses a gear train system to vary the spindle speed for turning operations.
The document contains a title and repeatedly quotes Neil Armstrong's famous words upon being the first person to walk on the moon: "It's one small step for man, one giant leap for mankind." This quote about the significance of exploring space is used as the best quote reflecting the document's approach.
1) Strain energy is the energy stored in a material body due to elastic deformation caused by external loads. It is calculated using the area under the stress-strain curve.
2) Strain energy is calculated differently for different loading conditions like axial loading, torsion, and bending. For axial loading and torsion, strain energy is proportional to the load and length. For bending, strain energy is proportional to the bending moment squared and inversely proportional to the flexural rigidity.
3) The document presents an example calculation of strain energy in a beam under a combination of point loads using the bending moment formulae and integrating them along the length. The total strain energy is found to be 14.38 N
This document discusses strain energy and methods for calculating strain energy under different loading conditions. Strain energy is the energy stored in a material due to deformation from an external load. It presents formulas for calculating strain energy under axial loading, torsion, and bending. For axial loading and torsion, strain energy is proportional to the load and deformation. For bending, strain energy is proportional to the bending moment squared and inversely proportional to the flexural rigidity. An example problem demonstrates calculating the total strain energy in a beam under a combination of point loads.
The document discusses a human eye inspired camera based on biomimicry. It was presented by Arnab Hazra, a 2nd year student at Cooch Behar Government Engineering College with a roll number of 34900721009. The presentation thanked the audience at the end.
This document provides an overview of operational amplifiers (op-amps). It defines an op-amp as a DC-coupled high-gain electronic voltage amplifier. It describes the ideal properties of an op-amp including infinite gain and input/output impedances of zero and infinity. Non-ideal characteristics are also discussed. Common applications are presented such as analog to digital converters, current sources, and zero crossing detectors. Advantages include their versatility, while disadvantages include limitations in power and load resistance.
Signals are variables that carry information and can be described as a function of independent variables. They can be classified as continuous or discrete, periodic or non-periodic, deterministic or random. Key properties of systems include whether they are causal, linear, time-invariant, stable, static or dynamic. Linear time-invariant systems are particularly important for their mathematical tractability.
The compensation theorem states that any element in a linear, bilateral network can be replaced by a voltage source whose magnitude is equal to the current through the element multiplied by the element's value, provided the currents and voltages in other parts of the circuit remain unchanged. The theorem is useful for finding changes in current or voltage when a resistance value changes in a circuit. It can be proven by applying Kirchhoff's voltage law to calculate loop currents before and after an impedance change, and showing the current change is equal to the current from a compensating voltage source. An experiment was described to demonstrate the theorem by measuring currents in a circuit before and after a resistance change, and with a compensating source.
This document discusses different number systems including binary, decimal, octal, and hexadecimal. It provides details on each system such as their number bases and allowed digits. The document also describes how to convert between these different number systems using methods like dividing numbers by the target base or grouping binary digits into sets of four for hexadecimal conversion. The goal is to understand representation of numbers in computing systems which commonly use binary and hexadecimal formats.
The document discusses the P-N junction, which is formed at the interface between P-type and N-type semiconductors. It describes how doping the semiconductors with different impurities results in an excess or deficiency of electrons or holes. When the P and N-type materials are joined, charge carriers diffuse across the junction, leaving an electric field. This P-N junction exhibits rectifying behavior and has applications in diodes and transistors. The document also examines the I-V characteristics of a P-N junction diode under forward, reverse, and zero bias conditions.
Engineering mechanics deals with analyzing how physical bodies interact with applied forces and motion. It uses classical Newtonian mechanics to study problems in engineering. A rigid body is one that does not deform under applied forces, and mechanics examines the motion of particles, rigid bodies, and continuous distributions of mass called continua. Forces have magnitude, direction, and point and line of application, and can be combined into systems acting on bodies to understand their effects.
The document analyzes and classifies different types of trusses. It discusses what a truss is, its properties like axial tensile and compressive forces. Trusses are classified as determinate or indeterminate, plane or space trusses, and simple, compound or complex. Examples are provided. The analysis of determinate trusses using the method of joints and method of sections is explained along with identifying zero force members. References are included at the end.
Connect Conference 2022: Passive House - Economic and Environmental Solution...TE Studio
Passive House: The Economic and Environmental Solution for Sustainable Real Estate. Lecture by Tim Eian of TE Studio Passive House Design in November 2022 in Minneapolis.
- The Built Environment
- Let's imagine the perfect building
- The Passive House standard
- Why Passive House targets
- Clean Energy Plans?!
- How does Passive House compare and fit in?
- The business case for Passive House real estate
- Tools to quantify the value of Passive House
- What can I do?
- Resources
Technoblade The Legacy of a Minecraft Legend.Techno Merch
Technoblade, born Alex on June 1, 1999, was a legendary Minecraft YouTuber known for his sharp wit and exceptional PvP skills. Starting his channel in 2013, he gained nearly 11 million subscribers. His private battle with metastatic sarcoma ended in June 2022, but his enduring legacy continues to inspire millions.
Fonts play a crucial role in both User Interface (UI) and User Experience (UX) design. They affect readability, accessibility, aesthetics, and overall user perception.
Maximize Your Content with Beautiful Assets : Content & Asset for Landing Page pmgdscunsri
Figma is a cloud-based design tool widely used by designers for prototyping, UI/UX design, and real-time collaboration. With features such as precision pen tools, grid system, and reusable components, Figma makes it easy for teams to work together on design projects. Its flexibility and accessibility make Figma a top choice in the digital age.
Storytelling For The Web: Integrate Storytelling in your Design ProcessChiara Aliotta
In this slides I explain how I have used storytelling techniques to elevate websites and brands and create memorable user experiences. You can discover practical tips as I showcase the elements of good storytelling and its applied to some examples of diverse brands/projects..
EASY TUTORIAL OF HOW TO USE CAPCUT BY: FEBLESS HERNANEFebless Hernane
CapCut is an easy-to-use video editing app perfect for beginners. To start, download and open CapCut on your phone. Tap "New Project" and select the videos or photos you want to edit. You can trim clips by dragging the edges, add text by tapping "Text," and include music by selecting "Audio." Enhance your video with filters and effects from the "Effects" menu. When you're happy with your video, tap the export button to save and share it. CapCut makes video editing simple and fun for everyone!
Revolutionizing the Digital Landscape: Web Development Companies in Indiaamrsoftec1
Discover unparalleled creativity and technical prowess with India's leading web development companies. From custom solutions to e-commerce platforms, harness the expertise of skilled developers at competitive prices. Transform your digital presence, enhance the user experience, and propel your business to new heights with innovative solutions tailored to your needs, all from the heart of India's tech industry.
ARENA - Young adults in the workplace (Knight Moves).pdfKnight Moves
Presentations of Bavo Raeymaekers (Project lead youth unemployment at the City of Antwerp), Suzan Martens (Service designer at Knight Moves) and Adriaan De Keersmaeker (Community manager at Talk to C)
during the 'Arena • Young adults in the workplace' conference hosted by Knight Moves.
Practical eLearning Makeovers for EveryoneBianca Woods
Welcome to Practical eLearning Makeovers for Everyone. In this presentation, we’ll take a look at a bunch of easy-to-use visual design tips and tricks. And we’ll do this by using them to spruce up some eLearning screens that are in dire need of a new look.
Decormart Studio is widely recognized as one of the best interior designers in Bangalore, known for their exceptional design expertise and ability to create stunning, functional spaces. With a strong focus on client preferences and timely project delivery, Decormart Studio has built a solid reputation for their innovative and personalized approach to interior design.
2. Programming, Algorithm, Flowchart,
Pseudocode
• Programming is the process of creating a set of instructions that tell a computer
how to perform a task.
• An Algorithm is a finite sequence of instructions, each of which has a clear
meaning and can be performed with a finite amount of effort in a finite length of
time.
• A flowchart is simply a graphical representation of steps. It shows steps in
sequential order and is widely used in presenting the flow of algorithms, workflow
or processes.
• Pseudocode is an artificial and informal language that helps programmers to
develop algorithms.
28-07-2022 15:08 2
3. A sample C programming language
#include<stdio.h>
int main()
{
int hours=5;
int rate=4;
int pay;
pay= hours*rate;
printf("%d", pay);
return 0;
}
28-07-2022 15:08 3
6. C Keywords and Identifiers
• Character set
• A character set is a set of alphabets, letters and some special characters that are valid
in C language.
• Alphabets
• C accepts both lowercase and uppercase alphabets as variables and functions.
• Digits
• White space Characters
• Blank space, newline, horizontal tab, carriage return and form feed.
28-07-2022 15:08 6
8. C Keywords
• Keywords are predefined, reserved words used in programming that have
special meanings to the compiler. Keywords are part of the syntax and they
cannot be used as an identifier. For example:
• int pay;
• Here, int is a keyword that indicates pay is a variable of type int (integer).
• As C is a case sensitive language, all keywords must be written in lowercase.
Here is a list of all keywords allowed in ANSI C.
28-07-2022 15:08 8
10. C Identifiers
• Identifier refers to name given to entities such as variables, functions,
structures etc.
• Identifiers must be unique. They are created to give a unique name to an
entity to identify it during the execution of the program. For example:
• int pay;
• Here pay is an identifier
• Also remember, identifier names must be different from keywords.
28-07-2022 15:08 10
11. Rules for naming identifiers
• A valid identifier can have letters (both uppercase and lowercase letters),
digits and underscores.
• The first letter of an identifier should be either a letter or an underscore.
• You cannot use keywords like int, while etc. as identifiers.
• There is no rule on how long an identifier can be. However, you may run
into problems in some compilers if the identifier is longer than 31 characters.
28-07-2022 15:08 11
12. C Variables, Constants and Literals
• Variables
• In programming, a variable is a container (storage area) to hold data.
• To indicate the storage area, each variable should be given a unique name (identifier).
Variable names are just the symbolic representation of a memory location.
• For example:
• int playerScore = 95;
• Here, playerScore is a variable of int type. Here, the variable is assigned an integer value
95.
• The value of a variable can be changed, hence the name variable.
• char ch = 'a';
• // some code
• ch = 'l';
28-07-2022 15:08 12
13. Rules for naming a variable
• A variable name can only have letters (both uppercase and lowercase letters),
digits and underscore.
• The first letter of a variable should be either a letter or an underscore.
• There is no rule on how long a variable name (identifier) can be. However,
you may run into problems in some compilers if the variable name is longer
than 31 characters.
28-07-2022 15:08 13
14. Strongly typed language
• C is a strongly typed language. This means that the variable type cannot be changed
once it is declared. For example:
• int number = 5; // integer variable
• number = 5.5; // error
• double number; // error
• Here, the type of number variable is int. You cannot assign a floating-point
(decimal) value 5.5 to this variable. Also, you cannot redefine the data type of the
variable to double. By the way, to store the decimal values in C, you need to declare
its type to either double or float.
28-07-2022 15:08 14
15. Literals
• Literals are data used for representing fixed values. They can be used directly
in the code. For example: 1, 2.5, 'c' etc.
• Here, 1, 2.5 and 'c' are literals. Why? You cannot assign different values to
these terms.
28-07-2022 15:08 15
16. Integers
• An integer is a numeric literal(associated with numbers) without any fractional or
exponential part. There are three types of integer literals in C programming:
• decimal (base 10)
• octal (base 8)
• hexadecimal (base 16)
• For example:
• Decimal: 0, -9, 22 etc
• Octal: 021, 077, 033 etc
• Hexadecimal: 0x7f, 0x2a, 0x521 etc
• In C programming, octal starts with a 0, and hexadecimal starts with a 0x
28-07-2022 15:08 16
17. Floating-point Literals
• A floating-point literal is a numeric literal that has either a fractional form or
an exponent form. For example:
• -2.0
• 0.0000234
• -0.22E-5
28-07-2022 15:08 17
18. Characters
• A character literal is created by enclosing a single character inside single
quotation marks. For example: 'a', 'm', 'F', '2', '}' etc.
28-07-2022 15:08 18
19. Escape Sequences
• Sometimes, it is necessary to use characters that cannot be typed or has
special meaning in C programming. For example: newline(enter), tab,
question mark etc.
• In order to use these characters, escape sequences are used.
28-07-2022 15:08 19
21. String Literals
• A string literal is a sequence of characters enclosed in double-quote marks.
For example:
• "good" //string constant
• "" //null string constant
• " " //string constant of six white space
• "x" //string constant having a single character.
• "Earth is roundn" //prints string with a newline
28-07-2022 15:08 21
22. Constants
• If you want to define a variable whose value cannot be changed, you can use
the const keyword. This will create a constant. For example,
• const double PI = 3.14;
• Notice, we have added keyword const.
• Here, PI is a symbolic constant; its value cannot be changed.
• const double PI = 3.14;
• PI = 2.9; //Error
28-07-2022 15:08 22
23. C Data Types
• In C programming, data types are declarations for variables. This determines
the type and size of data associated with variables. For example,
• int myVar;
• Here, myVar is a variable of int (integer) type. The size of int is 4 bytes.
28-07-2022 15:08 23
25. int
• Integers are whole numbers that can have both zero, positive and negative
values but no decimal values. For example, 0, -5, 10
• We can use int for declaring an integer variable.
• int id;
• Here, id is a variable of type integer.
• You can declare multiple variables at once in C programming. For example,
• int id, age;
• The size of int is usually 4 bytes (32 bits). And, it can take 232 distinct states
from -2147483648 to 2147483647.
28-07-2022 15:08 25
26. float and double
• float and double are used to hold real numbers.
• float salary;
• double price;
• In C, floating-point numbers can also be represented in exponential. For
example,
• float normalizationFactor = 22.442e2;
• What's the difference between float and double?
• The size of float (single precision float data type) is 4 bytes. And the size of
double (double precision float data type) is 8 bytes.
28-07-2022 15:08 26
27. char and void
• Keyword char is used for declaring character type variables. For example,
• char test = 'h';
• The size of the character variable is 1 byte.
• void is an incomplete type. It means "nothing" or "no type". You can think
of void as absent.
• For example, if a function is not returning anything, its return type should be
void.
• Note that, you cannot create variables of void type.
28-07-2022 15:08 27
28. short and long
• If you need to use a large number, you can use a type specifier long. Here's how:
• long a;
• long long b;
• long double c;
Here variables a and b can store integer values. And, c can store a floating-point number.
• If you are sure, only a small integer ([−32,767, +32,767] range) will be used, you can use
short.
• short d;
• You can always check the size of a variable using the sizeof() operator.
28-07-2022 15:08 28
29. signed and unsigned
• In C, signed and unsigned are type modifiers. You can alter the data storage of a
data type by using them. For example,
• unsigned int x;
• int y;
• Here, the variable x can hold only zero and positive values because we have used the
unsigned modifier.
• Considering the size of int is 4 bytes, variable y can hold values from -231 to 231-1,
whereas variable x can hold values from 0 to 232-1.
• Other data types defined in C programming are:
• bool Type
• Enumerated type
• Complex types
28-07-2022 15:08 29
30. Derived Data Types
• Data types that are derived from fundamental data types are derived types.
For example: arrays, pointers, function types, structures, etc.
28-07-2022 15:08 30
31. C Input Output (I/O)
• C Output
• In C programming, printf() is one of the main output function. The function
sends formatted output to the screen.
28-07-2022 15:08 31
32. Example 1: C Output
• #include <stdio.h>
• int main()
• {
• // Displays the string inside quotations
• printf("C Programming");
• return 0;
• }
• Output
• C Programming
28-07-2022 15:08 32
33. How does this program work?
• All valid C programs must contain the main() function. The code execution
begins from the start of the main() function.
• The printf() is a library function to send formatted output to the screen. The
function prints the string inside quotations.
• To use printf() in our program, we need to include stdio.h header file using
the #include<stdio.h> statement.
• The return 0; statement inside the main() function is the "Exit status" of the
program. It's optional.
28-07-2022 15:08 33
34. Example 2: Integer Output
• #include <stdio.h>
• int main()
• {
• int testInteger = 5;
• printf("Number = %d", testInteger);
• return 0;
• }
• Output
Number = 5
• We use %d format specifier to print int types. Here, the %d inside the quotations
will be replaced by the value of testInteger.
28-07-2022 15:08 34
35. Example 3: float and double Output
• #include <stdio.h>
• int main()
• {
• float number1 = 13.5;
• double number2 = 12.4;
• printf("number1 = %fn", number1);
• printf("number2 = %lf", number2);
• return 0;
• }
• Output
• number1 = 13.500000
• number2 = 12.400000
• To print float, we use %f format specifier. Similarly, we use %lf to print double values.
28-07-2022 15:08 35
36. Example 4: Print Characters
• #include <stdio.h>
• int main()
• {
• char chr = 'a';
• printf("character = %c", chr);
• return 0;
• }
• Output
• character = a
• To print char, we use %c format specifier.
28-07-2022 15:08 36
37. C Input
• In C programming, scanf() is one of the commonly used function to take
input from the user.
• The scanf() function reads formatted input from the standard input such as
keyboards.
28-07-2022 15:08 37
38. Example 5: Integer Input/Output
• #include <stdio.h>
• int main()
• {
• int testInteger;
• printf("Enter an integer: ");
• scanf("%d", &testInteger);
• printf("Number = %d",testInteger);
• return 0;
• }
• Output
• Enter an integer: 4
• Number = 4
28-07-2022 15:08 38
39. Example 5: Integer Input/Output
• Here, we have used %d format specifier inside the scanf() function to take
int input from the user. When the user enters an integer, it is stored in the
testInteger variable.
• Notice, that we have used &testInteger inside scanf(). It is because
&testInteger gets the address of testInteger, and the value entered by the
user is stored in that address.
28-07-2022 15:08 39
40. Example 6: Float and Double
Input/Output
#include <stdio.h>
int main()
{
float num1;
double num2;
printf("Enter a number: ");
scanf("%f", &num1);
printf("Enter another number: ");
scanf("%lf", &num2);
printf("num1 = %fn", num1);
printf("num2 = %lf", num2);
return 0;
}
• Output
• Enter a number: 12.523
• Enter another number: 10.2
• num1 = 12.523000
• num2 = 10.200000
• We use %f and %lf format specifier for float and double respectively.
28-07-2022 15:08 40
41. Example 7: C Character I/O
#include <stdio.h>
int main()
{
char chr;
printf("Enter a character: ");
scanf("%c",&chr);
printf("You entered %c.", chr);
return 0;
}
• Output
• Enter a character: g
• You entered g
28-07-2022 15:08 41
42. Example 7: C Character I/O
• When a character is entered by the user in the above program, the character
itself is not stored. Instead, an integer value (ASCII value) is stored.
• And when we display that value using %c text format, the entered character
is displayed. If we use %d to display the character, it's ASCII value is printed.
28-07-2022 15:08 42
43. Example 8: ASCII Value
#include <stdio.h>
int main()
{
char chr;
printf("Enter a character: ");
scanf("%c", &chr);
// When %c is used, a character is displayed
printf("You entered %c.n",chr);
// When %d is used, ASCII value is displayed
printf("ASCII value is %d.", chr);
return 0;
}
• Output
• Enter a character: g
• You entered g.
• ASCII value is 103.
28-07-2022 15:08 43
44. I/O Multiple Values
Here's how you can take multiple inputs from the user and display them.
#include <stdio.h>
int main()
{
int a;
float b;
printf("Enter integer and then a float: ");
// Taking multiple inputs
scanf("%d%f", &a, &b);
printf("You entered %d and %f", a, b);
return 0;
}
• Output
• Enter integer and then a float: -3
• 3.4
• You entered -3 and 3.400000
28-07-2022 15:08 44
45. Format Specifiers for I/O
• As you can see from the above examples, we use
• %d for int
• %f for float
• %lf for double
• %c for char
• Here's a list of commonly used C data types and their format specifiers.
28-07-2022 15:08 45
46. Data Type Format Specifier
int %d
char %c
float %f
double %lf
short int %hd
unsigned int %u
long int %li
long long int %lli
unsigned long int %lu
unsigned long long int %llu
signed char %c
unsigned char %c
long double %Lf
28-07-2022 15:08 46
47. C Programming Operators
• An operator is a symbol that operates on a value or a variable. For example:
+ is an operator to perform addition.
• C has a wide range of operators to perform various operations.
28-07-2022 15:08 47
48. C Arithmetic Operators
• An arithmetic operator performs mathematical operations such as addition,
subtraction, multiplication, division etc. on numerical values (constants and
variables).
Operator Meaning of Operator
+ addition or unary plus
- subtraction or unary minus
* multiplication
/ division
% remainder after division (modulo division)
28-07-2022 15:08 48
49. C Increment and Decrement Operators
• C programming has two operators increment ++ and decrement -- to change
the value of an operand (constant or variable) by 1.
• Increment ++ increases the value by 1 whereas decrement -- decreases the
value by 1. These two operators are unary operators, meaning they only
operate on a single operand.
28-07-2022 15:08 49
50. Example 2: Increment and Decrement
Operators
// Working of increment and decrement operators
#include <stdio.h>
int main()
{
int a = 10, b = 100;
float c = 10.5, d = 100.5;
printf("++a = %d n", ++a);
printf("--b = %d n", --b);
printf("++c = %f n", ++c);
printf("--d = %f n", --d);
return 0;
}
Output
++a = 11
--b = 99
++c = 11.500000
--d = 99.500000
28-07-2022 15:08 50
51. C Assignment Operators
• An assignment operator is used for assigning a value to a variable. The most
common assignment operator is =
Operator Example Same as
= a = b a = b
+= a += b a = a+b
-= a -= b a = a-b
*= a *= b a = a*b
/= a /= b a = a/b
%= a %= b a = a%b
28-07-2022 15:08 51
52. C Relational Operators
• A relational operator checks the relationship between two operands. If the
relation is true, it returns 1; if the relation is false, it returns value 0.
Operator Meaning of Operator Example
== Equal to 5 == 3 is evaluated to 0
> Greater than 5 > 3 is evaluated to 1
< Less than 5 < 3 is evaluated to 0
!= Not equal to 5 != 3 is evaluated to 1
>= Greater than or equal to 5 >= 3 is evaluated to 1
<= Less than or equal to 5 <= 3 is evaluated to 0
28-07-2022 15:08 52
53. Example 4: Relational Operators
// Working of relational operators
#include <stdio.h>
int main()
{
int a = 5, b = 5, c = 10;
printf("%d == %d is %d n", a, b, a == b);
printf("%d == %d is %d n", a, c, a == c);
printf("%d > %d is %d n", a, b, a > b);
printf("%d > %d is %d n", a, c, a > c);
printf("%d < %d is %d n", a, b, a < b);
printf("%d < %d is %d n", a, c, a < c);
printf("%d != %d is %d n", a, b, a != b);
printf("%d != %d is %d n", a, c, a != c);
printf("%d >= %d is %d n", a, b, a >= b);
printf("%d >= %d is %d n", a, c, a >= c);
printf("%d <= %d is %d n", a, b, a <= b);
printf("%d <= %d is %d n", a, c, a <= c);
return 0;
}
28-07-2022 15:08 53
54. Example 4: Relational Operators output
Output
5 == 5 is 1
5 == 10 is 0
5 > 5 is 0
5 > 10 is 0
5 < 5 is 0
5 < 10 is 1
5 != 5 is 0
5 != 10 is 1
5 >= 5 is 1
5 >= 10 is 0
5 <= 5 is 1
5 <= 10 is 1
28-07-2022 15:08 54
55. C Logical Operators
• An expression containing logical operator returns either 0 or 1 depending
upon whether expression results true or false.
Operator Meaning Example
&&
Logical AND. True only if all
operands are true
If c = 5 and d = 2 then,
expression ((c==5) && (d>5))
equals to 0.
||
Logical OR. True only if either
one operand is true
If c = 5 and d = 2 then,
expression ((c==5) || (d>5))
equals to 1.
!
Logical NOT. True only if the
operand is 0
If c = 5 then, expression !(c==5)
equals to 0. 28-07-2022 15:08 55
56. Example 5: Logical Operators
// Working of logical operators
#include <stdio.h>
int main()
{
int a = 5, b = 5, c = 10, result;
result = (a == b) && (c > b);
printf("(a == b) && (c > b) is %d n", result);
result = (a == b) && (c < b);
printf("(a == b) && (c < b) is %d n", result);
result = (a == b) || (c < b);
printf("(a == b) || (c < b) is %d n", result);
result = (a != b) || (c < b);
printf("(a != b) || (c < b) is %d n", result);
result = !(a != b);
printf("!(a != b) is %d n", result);
result = !(a == b);
printf("!(a == b) is %d n", result);
return 0;
}
28-07-2022 15:08 56
57. • Output
(a == b) && (c > b) is 1
(a == b) && (c < b) is 0
(a == b) || (c < b) is 1
(a != b) || (c < b) is 0
!(a != b) is 1
!(a == b) is 0
28-07-2022 15:08 57
58. C Bitwise Operators
• During computation, mathematical operations like: addition, subtraction,
multiplication, division, etc are converted to bit-level which makes processing
faster and saves power.
• Bitwise operators are used in C programming to perform bit-level
operations.
28-07-2022 15:08 58
59. C Bitwise Operators: Contd.
Operators Meaning of operators
& Bitwise AND
| Bitwise OR
^ Bitwise exclusive OR
~ Bitwise complement
<< Shift left
>> Shift right
28-07-2022 15:08 59
60. sizeof operator
• The sizeof operator
• The sizeof is a unary operator that returns the size of data (constants, variables,
array, structure, etc).
#include <stdio.h>
void main()
{
char a;
printf("Size of char=%lu bytesn",sizeof(a));
}
• Output
• Size of char = 4 bytes
28-07-2022 15:08 60
61. Conditional or Ternary Operator (?:)
Here, Expression1 is the condition to be evaluated. If the condition(Expression1) is True then
Expression2 will be executed and the result will be returned. Otherwise, if the
condition(Expression1) is false then Expression3 will be executed and the result will be returned.
28-07-2022 15:08 61
62. Example: Program to Store the greatest of the
two Number.
#include <stdio.h>
int main()
{
int a=2,b=3,c;
c=a>b?a:b;
printf("%d is greater ",c);
return 0;
}
• Output
• 3 is greater
28-07-2022 15:08 62
63. Errors in C
• Error is an illegal operation performed by the user which results in abnormal
working of the program.
• Programming errors often remain undetected until the program is compiled
or executed.
• Some of the errors inhibit the program from getting compiled or executed.
• Thus errors should be removed before compiling and executing.
28-07-2022 15:08 63
64. Syntax errors
• Errors that occur when you violate the rules of writing C syntax are known
as syntax errors.
• Most frequent syntax errors are:
• Missing Parenthesis (})
• Printing the value of variable without declaring it
• Missing semicolon
28-07-2022 15:08 64
65. Run-time Errors
• Errors which occur during program execution(run-time) after successful
compilation are called run-time errors
• One of the most common run-time error is division by zero also known as
Division error
28-07-2022 15:08 65
66. Linker Errors
• These error occurs when after compilation we link the different object files
with main’s object
• These are errors generated when the executable of the program cannot be
generated.
• This may be due to wrong function prototyping, incorrect header files.
• One of the most common linker error is writing Main() instead of main().
28-07-2022 15:08 66
67. Logical Errors
• On compilation and execution of a program, desired output is not obtained
when certain input values are given
• These types of errors which provide incorrect output but appears to be error
free are called logical errors
28-07-2022 15:08 67
68. Logical Errors : Example
int main()
{
int i = 0;
// logical error : a semicolon after loop
for(i = 0; i < 3; i++);
{
printf("loop ");
continue;
}
getchar();
return 0;
}
28-07-2022 15:08 68
69. Semantic errors
• This error occurs when the statements written in the program are not meaningful to
the compiler.
• Example:
// C program to illustrate
// semantic error
void main()
{
int a, b, c;
a + b = c; //semantic error
}
28-07-2022 15:08 69
70. Object Code
• Object code generally refers to the output, a compiled file, which is
produced when the Source Code is compiled with a C compiler.
• The object code file contains a sequence of machine-readable instructions
that is processed by the CPU in a computer.
28-07-2022 15:08 70
71. Executable code
• Executable (also called the Binary) is the output of a linker after it
processes the object code.
• A machine code file can be immediately executable (i.e., runnable as a
program), or it might require linking with other object code files (e.g.
libraries) to produce a complete executable program.
28-07-2022 15:08 71
72. Linker
• In computer science, a linker is a computer program that takes one or more
object files generated by a compiler and combines them into one, executable
program.
28-07-2022 15:08 72
73. Loader
• In computer systems a loader is the part of an operating system that is
responsible for loading programs and libraries.
28-07-2022 15:08 73