A flow chart is a graphical representation of a process using different symbols to represent each step linked by arrows. An algorithm is a step-by-step method to solve a problem or make decisions. The main differences between an algorithm and flowchart are that an algorithm is a set of rules to solve a problem while a flowchart is a diagram that visually represents an algorithm. C programming variables must be declared with a data type and can be initialized with a starting value. Variables can be declared locally inside functions or globally outside any functions.
The document outlines topics to be covered in a C programming course, including structure of C programs, identifiers, data types, constants, variables, expressions, and operators. It provides details on each topic in 3 sentences or less:
The structure of a C program consists of functions, with one function called main executing first. Functions contain a heading, argument declarations, and a compound statement enclosed in braces. Compound statements can be nested and expressions must end with semicolons.
This document provides an overview of fundamental concepts in C programming language including header files, character sets, tokens, keywords, identifiers, variables, constants, operators, data types, and control structures. Header files contain predefined standard library functions that are included using directives like #include<stdio.h>. C has 32 reserved keywords that cannot be used as identifiers. Variables are used to store and manipulate data in a program. Constants represent fixed values like integers, characters, and floating-point numbers. Operators perform operations on variables and constants. Data types specify the type and size of a variable. Control structures like if-else and loops are used to control the flow of a program.
This Document about is C Programming language. You will learn Operators in C.
Types of operators-
Arithmetic Operators
Relational Operators
Increment Operator
Decrement Operator
Logical Operators
Conditional Operator
C++ is a general-purpose programming language created by Bjarne Stroustrup in 1979. It has imperative, object-oriented and generic programming features. The structure of a C++ program includes preprocessor directives, a main() function, and a program body. Variables are declared with a data type and used to store and manipulate data. C++ supports various operators for arithmetic, relational, logical, and bitwise operations.
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, input/output, and how to compile and execute a C program.
C is a middle-level programming language developed in the 1970s at Bell Labs. It is modular, portable, reusable, and features functions, keywords, and standard libraries. C code is written in functions and compiled before being executed on a computer to solve problems.
Learning c - An extensive guide to learn the C LanguageAbhishek Dwivedi
This document covers entire C language thoroughly. Its for all the students or professionals who would like to learn C or would like to brush up their knowledge with a quick recap.
The document outlines topics to be covered in a C programming course, including structure of C programs, identifiers, data types, constants, variables, expressions, and operators. It provides details on each topic in 3 sentences or less:
The structure of a C program consists of functions, with one function called main executing first. Functions contain a heading, argument declarations, and a compound statement enclosed in braces. Compound statements can be nested and expressions must end with semicolons.
This document provides an overview of fundamental concepts in C programming language including header files, character sets, tokens, keywords, identifiers, variables, constants, operators, data types, and control structures. Header files contain predefined standard library functions that are included using directives like #include<stdio.h>. C has 32 reserved keywords that cannot be used as identifiers. Variables are used to store and manipulate data in a program. Constants represent fixed values like integers, characters, and floating-point numbers. Operators perform operations on variables and constants. Data types specify the type and size of a variable. Control structures like if-else and loops are used to control the flow of a program.
This Document about is C Programming language. You will learn Operators in C.
Types of operators-
Arithmetic Operators
Relational Operators
Increment Operator
Decrement Operator
Logical Operators
Conditional Operator
C++ is a general-purpose programming language created by Bjarne Stroustrup in 1979. It has imperative, object-oriented and generic programming features. The structure of a C++ program includes preprocessor directives, a main() function, and a program body. Variables are declared with a data type and used to store and manipulate data. C++ supports various operators for arithmetic, relational, logical, and bitwise operations.
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, input/output, and how to compile and execute a C program.
C is a middle-level programming language developed in the 1970s at Bell Labs. It is modular, portable, reusable, and features functions, keywords, and standard libraries. C code is written in functions and compiled before being executed on a computer to solve problems.
Learning c - An extensive guide to learn the C LanguageAbhishek Dwivedi
This document covers entire C language thoroughly. Its for all the students or professionals who would like to learn C or would like to brush up their knowledge with a quick recap.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, I/O streams, variables, comments, and common errors. It explains that Bjarne Stroustrup extended C to create C++, adding object-oriented features from Simula. The main components discussed are the building blocks of any C++ program - characters, tokens, data types, and basic input/output operations.
The C programming language was created in 1972 at Bell Labs by Dennis Ritchie. It is a high-level, structured programming language that incorporates features of low-level languages like assembly. C programs use header files, variables, operators, input/output functions, and control statements like if/else and loops. Keywords, data types, and functions make C a flexible yet efficient language used widely in software development.
The document provides an overview of the C programming language, including its history, characteristics, environment, structure, data types, variables, decision making, looping, libraries, and uses. It describes how C was developed at Bell Labs in the early 1970s and later standardized. The summary highlights C's small fixed set of keywords, static typing, use of headers and functions, and popularity for systems programming and performance-critical applications due to its efficiency and ability to access hardware.
This document provides an overview of the C programming language, including:
- Why software is needed for embedded systems and choosing an appropriate programming language
- Key features of C like being easier/faster to develop with, portability, and efficient pointer usage
- Differences between embedded C and desktop C like writing low-level and inline assembly code
- The structure of a basic C program and a "Hello, World!" example
- C programming basics like constants, variables, data types, and arithmetic, relational, logical, and bitwise operators
- Control flow statements in C like if, if/else, and switch
The document provides an overview of the C programming language. It discusses that C was developed at Bell Labs in the 1970s and is a general purpose language closely associated with UNIX. It then covers C's character set, keywords, basic program structure including header files and library functions, data types, variables, constants, and provides a simple "Hello World" example program.
C is a procedural programming language. It was developed in the early 1970s and is still widely used. The document provides an overview of key aspects of C including data types, variables, constants, operators, control statements like if/else, and functions. It also discusses C programming concepts like low-level vs high-level languages, header files, comments, escape sequences, and more. The document serves as a useful introduction and reference for someone learning the basics of the C programming language.
C programming is a general-purpose language developed in the 1970s to write operating systems like UNIX. It is one of the most widely used languages, particularly for systems programming. Some key facts: C was created to develop UNIX and is still widely used for operating systems, compilers, databases and other modern programs. It has various data types like integers, floats, characters, arrays and structures. Variables are defined with a data type and can be initialized. C code is written in files with a .c extension and preprocessed before compilation.
OpenGurukul : Language : C ProgrammingOpen Gurukul
C is a general-purpose programming language that has been widely used since the early 1970s. Some key points about C programming covered in the document include:
- C was developed in the early 1970s and has since become widely popular for system and application software development due to its portability, efficiency, and ability to access hardware.
- C programs are typically structured using functions, header files, type definitions, and main functions. Input/output is handled using functions like printf and scanf.
- C supports basic data types like integers, floats, characters and strings. Variables must be declared before use and can be initialized.
- The document provides examples of C programs and covers basic concepts like constants
C Tokens, Escape sequence, Delimiters, Variables, Data types, Constants/ Literals, Expressions, Statements and Comments
https://github.com/ashim888/csit-c
This document provides an overview of C++ programming concepts including:
1. C++ programs consist of functions, with every program containing a main() function. Functions contain declarations, statements, comments, and can call libraries.
2. Variables must be declared with a type and can be used to store values. C++ supports integer, floating point, character, and other variable types.
3. C++ allows selection and decision making using if/else statements, switch statements, logical operators, and loops like while and for. Operators allow comparisons and boolean evaluations.
C is a programming language created in 1972 at Bell Labs to design the UNIX operating system. It spread quickly due to its power and portability. In 1989, ANSI standardized C to resolve issues from different compiler versions. C is an excellent choice for first programs due to its efficiency, flexibility, portability, and ability to write system software and packages. It has a rich set of data types, operators, and functions and allows extending functionality with custom functions. Variables are names for memory locations that can hold different data types and values.
The document provides an overview of the C programming language, including its history, basic structure, data types, operators, input/output, decision making, looping, functions, arrays, pointers, strings, structures, file handling, and linked data structures. Some key topics covered include the C compilation process, basic C program structure, common data types like int and char, arithmetic, relational, and logical operators, if/else and switch statements, while, do-while and for loops, defining functions, and passing arguments to functions.
This document provides an overview of basic concepts in C programming including data types, variables, constants, and storage classes. It discusses the basic structure of a C program and sections like main(), functions, and declarations. It describes various data types in C like integer, float, character, and string. Rules for identifiers, keywords, and comments are also covered. The document explains variable declaration and assignment as well as constants like integer, real, character, string and escape sequences. Storage classes and scope of variables are discussed.
C is a programming language created by Dennis Ritchie at Bell Labs in 1972 to develop the UNIX operating system. It quickly became popular due to its efficiency, flexibility, and portability. In 1989, ANSI standardized C to promote consistency, and it has since become one of the most widely used programming languages. Variables in C must be declared before use and can be numeric like integers and floats, or character strings. Variable names follow specific rules and types must be specified in declarations.
This document provides an introduction to programming in C. It discusses that C was developed in 1972 by Dennis Ritchie and stands between problem-oriented and machine-oriented programming languages. It also outlines some of the basic elements of C like data types, variables, constants, and keywords. The document provides rules for constructing integer, real and character constants, and describes variables and the main function in C programs. It gives an example of a simple first C program to calculate simple interest.
The document discusses various C programming concepts like algorithms, flowcharts, tokens, data types, operators, functions, and hardware components of a computer. It includes questions and answers on these topics. Key points covered are definition of algorithm and flowchart, different types of tokens in C, differences between while and do-while loops, definition of software and its types, and examples of standard header files.
C programs are composed of six types of tokens: keywords, identifiers, constants, strings, special symbols, and operators. Keywords are reserved words that serve as building blocks for statements and cannot be used as names. Identifiers name variables, functions, and arrays and must begin with a letter. Constants represent fixed values and come in numeric, character, and string forms. Special symbols include braces, parentheses, and brackets that indicate code blocks, function calls, and arrays. Operators perform arithmetic, assignment, comparison, logic, and other operations.
C++ variables can hold different data types like numbers and characters. Variables must be declared with a name and type before use and can be assigned values. Keywords like int and double are used to declare variable types for whole numbers and decimals. Variables are output using cout and input using cin. User input and output allows the program to display prompts and receive user-entered values.
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
The document provides information about algorithms and programming fundamentals in C++. It discusses what algorithms are, how to write them, and examples of algorithms to determine if a number is even or odd or if a student passed an exam. It also covers flowcharts, programming languages, data types, variables, operators, and comments in C++.
This document contains the questions and answers from a computer architecture and organization exam. It includes questions about the differences between computer architecture and organization, instruction formats, bus definitions, cache memory advantages, and virtual memory. The responses provide detailed explanations of concepts like locality of reference, thrashing, address mapping, cache hits and misses, and hierarchical memory systems. Justification is given for using a hierarchical approach to improve performance across different memory types. The differences between paging and segmentation in virtual memory are also distinguished.
This document lists 30 short questions and 19 long questions related to the subject of Theory of Computation for 5th semester CSE students. The questions cover topics such as the differences between DFAs and NFAs, regular expressions, grammars, languages, automata, Turing machines, complexity classes, and decidability. Example problems include designing automata to recognize specific languages, proving languages are context-free, and determining the relationships between computational models such as finite automata and Turing machines.
This document provides an introduction to C++ programming, covering key concepts like characters, tokens, keywords, identifiers, literals, operators, I/O streams, variables, comments, and common errors. It explains that Bjarne Stroustrup extended C to create C++, adding object-oriented features from Simula. The main components discussed are the building blocks of any C++ program - characters, tokens, data types, and basic input/output operations.
The C programming language was created in 1972 at Bell Labs by Dennis Ritchie. It is a high-level, structured programming language that incorporates features of low-level languages like assembly. C programs use header files, variables, operators, input/output functions, and control statements like if/else and loops. Keywords, data types, and functions make C a flexible yet efficient language used widely in software development.
The document provides an overview of the C programming language, including its history, characteristics, environment, structure, data types, variables, decision making, looping, libraries, and uses. It describes how C was developed at Bell Labs in the early 1970s and later standardized. The summary highlights C's small fixed set of keywords, static typing, use of headers and functions, and popularity for systems programming and performance-critical applications due to its efficiency and ability to access hardware.
This document provides an overview of the C programming language, including:
- Why software is needed for embedded systems and choosing an appropriate programming language
- Key features of C like being easier/faster to develop with, portability, and efficient pointer usage
- Differences between embedded C and desktop C like writing low-level and inline assembly code
- The structure of a basic C program and a "Hello, World!" example
- C programming basics like constants, variables, data types, and arithmetic, relational, logical, and bitwise operators
- Control flow statements in C like if, if/else, and switch
The document provides an overview of the C programming language. It discusses that C was developed at Bell Labs in the 1970s and is a general purpose language closely associated with UNIX. It then covers C's character set, keywords, basic program structure including header files and library functions, data types, variables, constants, and provides a simple "Hello World" example program.
C is a procedural programming language. It was developed in the early 1970s and is still widely used. The document provides an overview of key aspects of C including data types, variables, constants, operators, control statements like if/else, and functions. It also discusses C programming concepts like low-level vs high-level languages, header files, comments, escape sequences, and more. The document serves as a useful introduction and reference for someone learning the basics of the C programming language.
C programming is a general-purpose language developed in the 1970s to write operating systems like UNIX. It is one of the most widely used languages, particularly for systems programming. Some key facts: C was created to develop UNIX and is still widely used for operating systems, compilers, databases and other modern programs. It has various data types like integers, floats, characters, arrays and structures. Variables are defined with a data type and can be initialized. C code is written in files with a .c extension and preprocessed before compilation.
OpenGurukul : Language : C ProgrammingOpen Gurukul
C is a general-purpose programming language that has been widely used since the early 1970s. Some key points about C programming covered in the document include:
- C was developed in the early 1970s and has since become widely popular for system and application software development due to its portability, efficiency, and ability to access hardware.
- C programs are typically structured using functions, header files, type definitions, and main functions. Input/output is handled using functions like printf and scanf.
- C supports basic data types like integers, floats, characters and strings. Variables must be declared before use and can be initialized.
- The document provides examples of C programs and covers basic concepts like constants
C Tokens, Escape sequence, Delimiters, Variables, Data types, Constants/ Literals, Expressions, Statements and Comments
https://github.com/ashim888/csit-c
This document provides an overview of C++ programming concepts including:
1. C++ programs consist of functions, with every program containing a main() function. Functions contain declarations, statements, comments, and can call libraries.
2. Variables must be declared with a type and can be used to store values. C++ supports integer, floating point, character, and other variable types.
3. C++ allows selection and decision making using if/else statements, switch statements, logical operators, and loops like while and for. Operators allow comparisons and boolean evaluations.
C is a programming language created in 1972 at Bell Labs to design the UNIX operating system. It spread quickly due to its power and portability. In 1989, ANSI standardized C to resolve issues from different compiler versions. C is an excellent choice for first programs due to its efficiency, flexibility, portability, and ability to write system software and packages. It has a rich set of data types, operators, and functions and allows extending functionality with custom functions. Variables are names for memory locations that can hold different data types and values.
The document provides an overview of the C programming language, including its history, basic structure, data types, operators, input/output, decision making, looping, functions, arrays, pointers, strings, structures, file handling, and linked data structures. Some key topics covered include the C compilation process, basic C program structure, common data types like int and char, arithmetic, relational, and logical operators, if/else and switch statements, while, do-while and for loops, defining functions, and passing arguments to functions.
This document provides an overview of basic concepts in C programming including data types, variables, constants, and storage classes. It discusses the basic structure of a C program and sections like main(), functions, and declarations. It describes various data types in C like integer, float, character, and string. Rules for identifiers, keywords, and comments are also covered. The document explains variable declaration and assignment as well as constants like integer, real, character, string and escape sequences. Storage classes and scope of variables are discussed.
C is a programming language created by Dennis Ritchie at Bell Labs in 1972 to develop the UNIX operating system. It quickly became popular due to its efficiency, flexibility, and portability. In 1989, ANSI standardized C to promote consistency, and it has since become one of the most widely used programming languages. Variables in C must be declared before use and can be numeric like integers and floats, or character strings. Variable names follow specific rules and types must be specified in declarations.
This document provides an introduction to programming in C. It discusses that C was developed in 1972 by Dennis Ritchie and stands between problem-oriented and machine-oriented programming languages. It also outlines some of the basic elements of C like data types, variables, constants, and keywords. The document provides rules for constructing integer, real and character constants, and describes variables and the main function in C programs. It gives an example of a simple first C program to calculate simple interest.
The document discusses various C programming concepts like algorithms, flowcharts, tokens, data types, operators, functions, and hardware components of a computer. It includes questions and answers on these topics. Key points covered are definition of algorithm and flowchart, different types of tokens in C, differences between while and do-while loops, definition of software and its types, and examples of standard header files.
C programs are composed of six types of tokens: keywords, identifiers, constants, strings, special symbols, and operators. Keywords are reserved words that serve as building blocks for statements and cannot be used as names. Identifiers name variables, functions, and arrays and must begin with a letter. Constants represent fixed values and come in numeric, character, and string forms. Special symbols include braces, parentheses, and brackets that indicate code blocks, function calls, and arrays. Operators perform arithmetic, assignment, comparison, logic, and other operations.
C++ variables can hold different data types like numbers and characters. Variables must be declared with a name and type before use and can be assigned values. Keywords like int and double are used to declare variable types for whole numbers and decimals. Variables are output using cout and input using cin. User input and output allows the program to display prompts and receive user-entered values.
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
The document provides information about algorithms and programming fundamentals in C++. It discusses what algorithms are, how to write them, and examples of algorithms to determine if a number is even or odd or if a student passed an exam. It also covers flowcharts, programming languages, data types, variables, operators, and comments in C++.
This document contains the questions and answers from a computer architecture and organization exam. It includes questions about the differences between computer architecture and organization, instruction formats, bus definitions, cache memory advantages, and virtual memory. The responses provide detailed explanations of concepts like locality of reference, thrashing, address mapping, cache hits and misses, and hierarchical memory systems. Justification is given for using a hierarchical approach to improve performance across different memory types. The differences between paging and segmentation in virtual memory are also distinguished.
This document lists 30 short questions and 19 long questions related to the subject of Theory of Computation for 5th semester CSE students. The questions cover topics such as the differences between DFAs and NFAs, regular expressions, grammars, languages, automata, Turing machines, complexity classes, and decidability. Example problems include designing automata to recognize specific languages, proving languages are context-free, and determining the relationships between computational models such as finite automata and Turing machines.
This document discusses a new project to build affordable housing units. It provides details on the location, planned amenities, and expected completion date. The development will include 100 apartment units located near a park. Residents will have access to an outdoor pool and playground. Construction is scheduled to finish by the end of the year.
The document contains 10 code snippets showing different C programming examples:
1) Swapping two numbers using a third variable and without a third variable.
2) Calculating power of a number.
3) Counting digits of a number using while and for loops.
4) Finding the largest number from user input.
5) Calculating sum of digits of a number using while, for, and recursion.
6) Finding LCM and sum of an infinite GP series.
This document contains a list of expected questions for the Theory of Computation subject in the 5th semester of the Computer Science branch. It includes short questions, long questions, and questions covering various topics like DFAs, NFAs, regular expressions, context-free grammars, pushdown automata, Turing machines, complexity classes, decidability, and more. The list was prepared by Assistant Professor Santosh Kumar Rath.
This document lists expected questions from the Theory of Computation subject for 5th semester CSE students. It includes short questions and long questions on topics such as the differences between DFAs and NFAs, regular expressions, grammars, Turing machines, complexity classes, decidability, and more. A total of 30 short questions and 19 long questions are provided to help students prepare for their exam.
1) Functions allow breaking down programs into smaller, self-contained blocks of code that perform specific tasks. Functions make code more organized and reusable.
2) There are two types of functions in C: library functions that are predefined in header files, and user-defined functions that are defined by the user.
3) Functions make code more modular and reusable by allowing the same block of code to be easily called multiple times by name rather than having to rewrite the block.
This document contains model questions for an exam on object-oriented programming concepts in C++. It includes 30 short answer questions and 15 long answer questions covering topics such as object slicing, copy constructors, templates, exception handling, the this pointer, namespaces, inheritance, operator overloading, polymorphism, abstraction, iterators, containers, encapsulation, and friend functions. Students are asked to define key terms and write programs demonstrating various OOP concepts in C++.
The document provides an overview of three modules that cover topics in web technologies including the Internet, World Wide Web, HTML, JavaScript, CSS, DOM, CGI/Perl, Java Applets and more. Key concepts covered include how the Internet and WWW work, protocols, building websites using HTML, JavaScript programming fundamentals, external and internal CSS stylesheets, the HTML and XML DOM models, introducing CGI and Perl scripting, and writing Java applets. References for additional reading on related topics are also provided.
The document provides C code to calculate the sum of three mathematical series: 1) the sum of cubes from 1 to n, 2) the sum of natural numbers from 1 to n, and 3) the sum of squares from 1 to n. For each series, it prints the formula, sample C code to calculate the sum, and sample output. The C code takes the upper limit n as input and uses loops or direct formulae to calculate the sum and output the result.
This document provides an overview of database management systems and related concepts. It discusses the three schema architecture including external, conceptual, and internal schemas. It also covers data models, data definition and manipulation languages, database administrators, keys such as primary keys and foreign keys, and integrity constraints including referential integrity, check constraints, and NOT NULL constraints. The goal of these concepts is to provide a structured and standardized way to define, manipulate, and manage database systems and data.
This very short document contains 4 instances of the letters "IWL". It does not provide much context or information to summarize in 3 sentences or less. The document repeats the abbreviation or letters "IWL" 4 times but no other details are given.
Data structure using c bcse 3102 pcs 1002SANTOSH RATH
This document contains a data structures exam from 2008 with 8 pages. It includes 10 multiple choice questions covering topics like data structures, binary trees, queues, stacks, graphs, and sorting algorithms. It also contains 8 additional problems requiring algorithms and programs related to linked lists, binary trees, heaps, graphs, searching, and polynomial representations. Students are instructed to answer question 1 and 5 of the additional problems.
SQL (Structured Query Language) is a standard language for accessing and manipulating databases. It allows users to execute queries against a database, retrieve data from a database, insert records into a database, update records in a database, and delete records from a database. Common SQL statements include SELECT to retrieve data, INSERT to add data, UPDATE to modify data, DELETE to remove data, and CREATE/ALTER to manage tables and databases.
This document discusses using principal component analysis (PCA) and the discrete cosine transform (DCT) to recognize images from a database. It explains how bitmaps store image data, DCT compacts image energy, and PCA reduces dimensionality by finding the principal components via eigenvectors of the covariance matrix. An algorithm is proposed that uses DCT, PCA on a 3x3 block, characteristic equations to find the maximum eigenvector, and least mean square comparison to recognize queries against the database images.
System programming involves creating system software that provides services to computer hardware rather than users. It requires an awareness of hardware. The document discusses types of system software like operating systems, utility programs, and database management systems. It also discusses types of application software like spreadsheets and presentation programs. The evolution of system programming components is explained, including assemblers that translate assembly language into machine code, and loaders that load programs into memory for execution.
This document contains a lab manual for data structures programming. It outlines various exercises including representing sparse matrices using arrays and linked lists, implementing stack and queue data structures using arrays and linked lists, and performing operations on singly, doubly and circular linked lists. It also covers binary tree traversals, binary search tree implementation and operations, and algorithms including heap sort, quick sort, depth first search, breadth first search and Dijkstra's algorithm.
This document provides an overview of C programming and data structures. It begins with an introduction to C language concepts like data types, variables, constants, I/O functions, operators, and control statements. It then discusses the history and evolution of C from earlier languages like ALGOL and BCPL. The document outlines characteristics of C and its applications. It also covers topics like keywords, identifiers, data type sizes, variable naming rules, and comment syntax. Library functions for input/output like scanf and printf are explained. The different types of constants in C like integer, real, character, and string constants are defined along with their syntax rules.
The document provides an introduction to the C programming language. It discusses the fundamentals of C including data types, variables, operators, control structures, arrays, functions, pointers, structures, unions, and file handling. The three key modules covered are: 1) C fundamentals, 2) arrays, functions, and strings, and 3) pointers, structures, unions, and file handling.
The document provides an introduction to algorithms and key concepts related to algorithms such as definition, features, examples, flowcharts, pseudocode. It also discusses different types of programming languages from first to fifth generation. Key points of structured programming approach and introduction to C programming language are explained including data types, variables, constants, input/output functions, operators, type conversion etc.
The document discusses the C programming language. It states that C was created by Dennis Ritchie at Bell Labs in 1972 to develop the UNIX operating system. It became more widely used after Brian Kernighan and Dennis Ritchie published the first description of C in 1978. C is a general-purpose, high-level language that produces efficient, low-level code and can be compiled on many platforms. It is widely used to develop operating systems, compilers, databases and other systems programs.
IIM.Com-FIT-Unit2(14.9.2021 TO 30.9.2021).pptxrajkumar490591
This document discusses various topics related to C programming language including:
- The structure of a typical C program which includes header files inclusion, main method declaration, variable declaration, function body, and return statement.
- Different types of variables in C like local, global, static, automatic, and external variables. Local variables are declared within a function while global variables are declared outside. Static variables retain their value between function calls.
- Key concepts like data types, valid variable names, compilers, linkers, and how a C program is executed after compilation.
C programming Training in Ambala ! Batra Computer Centrejatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide C Programming Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
The document provides an overview of the C programming language. It discusses that C is a general purpose, procedural language developed in 1972 at Bell Labs. C is a middle-level language as it allows programming at both high-level and assembly-level. Key aspects of C covered include data types, variables, operators, functions, arrays, pointers, memory management, and file handling. The document also provides examples of various C programming concepts.
The document provides information on C language basics. It discusses that C is a system programming language useful for writing system programs like compilers, drivers, etc. It is a structured language that supports functions and modular programming. C has many built-in functions and is portable, efficient, and can access hardware. Some key aspects covered include data types in C, variables, operators, conditional statements, and input/output functions. Examples of basic C programs are also included.
This document provides an introduction to fundamentals of programming with C#, including definitions of key concepts like algorithms, variables, data types, operators, and conditional statements. It explains that programming involves describing what you want the computer to do as a sequence of steps or algorithms. The stages of software development are outlined as gathering requirements, planning/design, implementation, testing, deployment, support, and documentation. An overview of C# programming language fundamentals is also provided, such as basic syntax structure, defining classes and methods, and using the console for input/output.
This document discusses various fundamental concepts in C programming such as flowcharts, pseudocode, control structures, variables, data types, operators, functions, arrays, structures, and input/output functions. It provides definitions and examples for each concept. Control structures covered include conditional statements like if-else and switch-case, as well as loops like while, do-while and for. Data types discussed are integer, floating point, character and string constants. Key concepts like variables, arrays, structures, functions and their declarations are also summarized.
C programming language tutorial for beginers.pdfComedyTechnology
This document provides an introduction and overview of the basics of C programming language. It discusses the following key topics in 3 or less sentences each:
- Introduction to programming and computer languages.
- Introduction to C programming, its history, uses, and why it is widely used.
- Program structure in C, including main functions, printf statements, comments, and return values.
- Basic syntax rules in C including semicolons, comments, identifiers, and whitespace.
- Common data types in C like char, int, float, and double and their purposes.
- How variables are named, defined through data type declaration, and initialized in C code.
- Common operators in
The document provides an overview of the C programming language and some key concepts related to it. It discusses C as a programming language developed in 1972, its features such as being case sensitive and supporting libraries and functions. It also defines some common C terms like header files, IDEs, keywords, variables and data types. Loops such as for, while and do-while loops are explained along with input/output functions like printf, scanf and control structures in programming.
C is a widely used general-purpose programming language that can be used to develop complex software like operating systems and databases. It has four basic data types - integer, character, floating-point, and double floating-point. Constants are declared using the const keyword and cannot change value during program execution. Operators perform actions on operands like arithmetic, relational, logical, and assignment operations. Conditional statements and loops allow control flow and repeated execution of code. Header files contain function declarations and macro definitions included using the #include directive. Structures group related variables under a single name. Functions perform specific tasks. Strings are arrays of characters terminated by a null character. C is a mid-level language providing both low-level and high
This document provides an introduction and overview of the C programming language. It discusses what a computer is and how programming languages work. It introduces machine language and high-level languages like C. Key aspects of C are explained, including data types, variables, operators, functions, and basic syntax. Examples of simple C programs are provided.
The document provides an introduction to the C programming language including its history, importance, basic structure, and key concepts. It was developed in 1972 by Dennis Ritchie at Bell Labs. C is a high-level language well-suited for system programming like operating systems and compilers. The basic structure of C programs includes sections for documentation, headers, preprocessor directives, global declarations, the main function, and subprograms. The document also discusses C tokens, variables, data types, input/output functions, and assignment statements.
C is a widely used general-purpose programming language that can be used to develop complex software like operating systems and databases. It supports basic data types like integers, characters, and floating-point values. Constants are declared using the const keyword and cannot change value during program execution. C includes various operators like arithmetic, relational, logical, and bitwise operators to perform operations. Conditional statements and loops allow for control flow and repeated execution of code. Header files contain function declarations and macro definitions that can be included using the #include directive. Structures group related data types under a single name. Functions are blocks of code that perform tasks. Strings are arrays of characters terminated by a null character.
This document provides an overview of programming in C. It discusses the importance of C as the base language for other programming languages and its efficiency. The basic structure of a C program is outlined as having documentation, include, define, global declaration, and main sections. Interpreters and compilers are explained as the two methods for running C programs, with compilers producing faster executable programs. Key aspects of C as a language are covered such as variables, data types, and constants.
The document discusses 50 computer programming questions related to C language. It covers topics like what is C language, data types in C, operators, functions, arrays, pointers, structures, preprocessor directives, header files and more. The questions provide explanations of key concepts in C programming to help understand the basics of the language.
The document discusses 50 computer programming questions related to C language. It covers topics like what is C language, data types in C, operators, functions, arrays, pointers, structures, preprocessor directives, header files, comments, variables and more. It provides definitions and explanations for key concepts in C programming.
The document provides an introduction to the C programming language. It discusses the structure of a C program including documentation, preprocessor directives, header files, and function definitions. It also describes various math and trigonometric functions available in the standard library like sqrt, pow, sin, cos, and log. The rest of the document outlines the steps to compile and execute a C program and defines key concepts like variables, constants, and data types in C.
Lesson plan proforma database management systemSANTOSH RATH
This document contains a lesson plan and progress sheet for a Database Management System course being taught over 3 semesters in 2014-15. It lists 48 topics divided across 3 modules that will be covered over the course, along with the planned and actual dates for delivering each topic and any remarks. The topics include introductions to databases, data models, SQL, normalization, transactions, concurrency, locking, recovery techniques, and more advanced DBMS concepts.
This document contains a lesson plan and progress sheet for a Programming in C course being taught over 3 modules during the first semester of the 2014-2015 academic year at the Gandhi Institute for Education and Technology in Bhubaneswar, India. The plan outlines 46 topics to be covered, including introductions to algorithms, flowcharts, data types, operators, control structures, arrays, strings, pointers, functions, structures, unions, files and I/O. Dates are provided for when each topic is planned to be delivered and actual delivery dates and remarks.
This document lists 30 short questions and 19 long questions related to the subject of Theory of Computation for 5th semester CSE students. The questions cover topics such as the differences between DFAs and NFAs, regular expressions, grammars, languages, automata, Turing machines, complexity classes, and decidability. Example problems include designing automata to recognize specific languages and proving properties of formal languages and grammars.
This document contains questions from various years (2008-2012) related to object oriented programming concepts in C++. The questions cover topics such as classes and objects, inheritance, polymorphism, exception handling, functions, pointers, arrays, operators, input/output etc. Short questions ranging from 2-5 marks and long questions ranging from 5-10 marks are included related to concepts, syntax, programs and differences.
This document contains questions for a database engineering examination. It includes questions about data definition language commands, differences between file processing systems and database systems, weak entity sets, cardinality, foreign keys, hashing techniques, lock types, differences between object-oriented and object-relational databases, rollup, entity-relationship modeling, converting models, B+ tree operations, relational algebra queries, relational calculus queries, SQL queries, and more. Students are asked to answer one compulsory question with multiple parts, and five questions from the remaining list.
This document contains a set of short and long questions related to database management systems. Some key topics covered include the entity-relationship model, relational data model, normalization, transaction processing, concurrency control, and database recovery. The questions range from definitions and short explanations to examples and multi-step problems involving conceptual and practical database concepts.
The document contains questions related to database management systems (DBMS). It covers topics like data modeling, relational algebra, SQL, transaction processing, concurrency control, and database design. Some key questions ask about the differences between primary and candidate keys, entity relationship modeling, normalization, and query optimization techniques.
This document provides an overview of operating system concepts including system components, batch systems, spooling, multiprogramming, time-sharing systems, distributed systems, parallel systems, real-time embedded systems, system structures, system calls, system programs, and process management. It describes the basic functions of an operating system in managing hardware resources, running application programs, and allowing multiple processes to run concurrently through techniques like multiprocessing and time-sharing.
This document provides an overview of operating system concepts including system components, operating system services, system programs, system calls, process management, and process states. It describes the four main components of a computer system as hardware, operating system, application programs, and users. It defines key operating system concepts such as multiprogramming, time-sharing, distributed systems, and real-time systems. It also explains process management topics like process states, process control blocks, and context switching.
This document contains an assignment on operating system concepts from Gandhi Institute of Education & Technology. It includes short notes on topics like conditions of deadlock, page vs segment, Belady's anomaly, critical section, fragmentation, monitors vs semaphores, race condition, binary vs counting semaphores, thrashing, lazy swapper, garbage collection and priority inheritance protocol. It also contains 10 long questions covering concepts like Banker's algorithm, page replacement algorithms, Peterson's solution for critical section problem, semaphores, thrashing, segment replacement, busy waiting, conditions of deadlock, producer-consumer problem, page fault and demand paging.
This document contains a set of short questions and long questions related to operating system concepts for an assignment. The short questions cover topics like the differences between processes and programs, different scheduling algorithms, process states, and functions of operating systems. The long questions involve drawing Gantt charts for scheduling algorithms, calculating turnaround and waiting times, describing functions and models of operating systems, and explaining concepts like context switching, process control blocks, and inter-process communication.
This document contains 10 questions related to operating system concepts such as file accessing methods, storage area networks, cache hit ratio, disk scheduling algorithms, memory management, I/O subsystem services like buffering and caching, file allocation methods, and Unix concepts like filters and inodes. The questions are from previous years' assignments given by Gandhi Institute for Education & Technology and range from short answer to longer descriptive questions.
This very short document contains 5 lines that simply state "IWL". It does not provide much context or information to summarize in only a few sentences. The document appears to be an acronym or initialism repeated on each line without any additional details given.
This very short document does not contain enough information to generate a meaningful 3 sentence summary. It only contains 3 instances of "IWL" without any other context or details provided.
This document contains an exam for a computer architecture and organization course, including 10 multiple choice questions covering various topics in the subject. The questions address issues like addressing modes, instruction cycles, interrupts, cache memory, virtual memory, and different types of computer architecture like Von Neumann architecture. Detailed answers are provided for each question exploring the key concepts and distinguishing between related terms. The exam was prepared by an assistant professor and provides an overview of the content covered in the course.
This document contains the exam questions and answers for the Computer Architecture and Organization course at Gandhi Institute for Education & Technology. It includes 9 multiple choice questions covering topics such as logical vs physical addresses, memory types like ROM and RAM, cache mapping schemes, and the differences between various memory technologies. It also includes the register organization of the 8085 microprocessor and explanations of microprogrammed control and the Wilkes model.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
Film vocab for eal 3 students: Australia the movie
Pc module1
1. !
"
What is a Flow Chart?
A flow chart is a graphical or symbolic representation of a process.
Each step in the process is represented by a different symbol and
contains a short description of the process step. The flow chart
symbols are linked together with arrows showing the process flow
direction.
What is an Algorithm? What are the steps of algorithm?
Step-by-step method of solving a problem or making decisions, as
in making a diagnosis.
Steps of the algorithm
) Finiteness: - an algorithm terminates after a finite numbers of
steps.
2) Definiteness: - each step in algorithm is unambiguous. This
means that the action specified by the step cannot be interpreted
(explain the meaning of) in multiple ways & can be performed
without any confusion.
3) Input: - an algorithm accepts zero or more inputs
4) Output:- it produces at least one output.
5) Effectiveness:- it consists of basic instructions that are
realizable. This means that the instructions can be performed by
using the given inputs in a finite amount of time
Difference between algorithm and flowchart?
An algorithm is a precise rule (or set of rules) specifying how to
solve some problem while A flowchart is a diagram of the sequence
of operations (pictorial representation of algorithm) in a computer
program
2. !
"
Keywords
The following keywords are reserved and may not be used as an
identifier for any other purpose.
auto double int long
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
Formatted String:
It specified to read which type of data.
%c CHARACTER
%d INTEGER
%f FLOAT
%lf DOUBLE
%u UNSIGNED
%s STRING
%Lf LONG DOUBLE
%ld LONG INT
3. !
"
Preprocessor directives in c
In c all the preprocessor directives start with # character except
define () operator. All the directives have different task which
executes just before the actual execution of c program which makes
the program more portable. These directives are used only to
instruct compilers.
Why preprocessor in c programming language?
Answer:
1. It improves the readability of program.
2. It makes easy to modify
3. Portability
#include directive in c
Syntax:
#include <filename>
or
#include “filename”
Task of include directive is to include or import any type file. There
are two form of include directive.
Form 1:
#include<filename>: This statement will search the file in include
directory (Default location of include directory is c:tcinclude). If
that file is present then #include statement is replaced by content of
file. If that file is not present then it will cause of compilation error.
//test.c
#include<stdio.h>
#include<conio.h>
void main(){
clrscr();
printf("HOW large is this file?");
4. !
"
getch();
}
C Programming - Data Types
C language data types can be broadly classified as
1. Primary data type
2. Derived data type
3. User-defined data type
Primary data type
All C Compilers accept the following fundamental data types
5. !
"
Secondary Data Types
• Array in C programming
An array in C language is a collection of similar data-type,
means an array can hold value of a particular data type for
which it has been declared. Arrays can be created from any of
the C data-types int,...
• Pointers in C Programming
In this tutorial I am going to discuss what pointer is and how
to use them in our C program. Many C programming learner
thinks that pointer is one of the difficult topic in C language
but its not...
• Structure in C Programming
We used variable in our C program to store value but one
variable can store only single piece information (an integer can
6. !
"
hold only one integer value) and to store similar type of values
we had to declare...
User defined type declaration
C language supports a feature where user can define an identifier
that characterizes an existing data type. This user defined data type
identifier can later be used to declare variables. In short its purpose
is to redefine the name of an existing data type.
Syntax: typedef <type> <identifier>; like
typedef int number;
Now we can use number in lieu of int to declare integer variable.
For example: “int x1” or “number x1” both statements declaring an
integer variable. We have just changed the default keyword “int” to
declare integer variable to “number
A data type defines a set of values that a variable can store along
with a set of operations that can be performed on that variable.
Common data types are integer, character, and floating-point.
Main ( ): All C programs consist of one or more functions. As a
general rule, the only function that must be present is called
main ( ), which is the first function called when program execution
begins
7. !
"
The general form of a C program:
Global declarations
int main(parameter list)
{
statement sequence
}
return-type f1(parameter list)
{
statement sequence
}
return-type f2(parameter list)
{
statement sequence
}...
return-type fN(parameter list)
{
statement sequence
Review of Terms
.
• Source code: The text of a program that a user can read,
commonly thought of as the program. The source code is input into
the C compiler.
• Object code: Translation of the source code of a program into
machine code, which the computer can read and execute directly.
Object code is the input to the linker.
• Linker: A program that links separately compiled modules into
one program. It also combines the functions in the Standard C
library with the code that you wrote. The output of the linker is an
executable program.
8. !
"
• Library: The file containing the standard functions that your
program can use. These functions include all I/O operations as well
as other useful routines.
• Compile time: The time during which your program is being
compiled.
• Run time: The time during which your program is executing
NOTE: The type void either explicitly declares a function as
returning no value or creates generic pointers
All Data Types Defined by the C Standard
Type Typical Size in
char 8 –127 to 127
unsigned char 8 0 to 255
signed char 8 –127 to 127
int 16 or 32 –32,767 to 32,767
unsigned int 16 or 32 0 to 65,535
signed int 16 or 32 Same as int
short int 16 –32,767 to 32,767
unsigned short int 16 0 to 65,535
signed short int 16 Same as short int
long int 32 –2,147,483,647 to 2,147,483,647
long long int 64 –(263 –1) to 263 –1 (Added by C99)
signed long int 32 Same as long int
unsigned long int 32 0 to 4,294,967,295
unsigned long long int 64 264 –1 (Added by C99)
float 32 1E–37 to 1E+37 with six digits of
precision
double 64 1E–37 to 1E+37 with ten digits of
precision
long double 80 1E–37 to 1E+37 with ten digits of
precision
9. !
"
Variables:
As you probably know, a variable is a named location in memory
that is used to hold a value that can be modified by the program. All
variables must be declared before they can be used. The general
form of a declaration is:
type variable_list;
Here, type must be a valid data type plus any modifiers, and
variable_list may consist of one or more identifier names separated
by commas. Here are some declarations:
Eg: int i, j, l;
Eg: short int si;
Eg: unsigned int ui;
Eg: double balance, profit, loss;
Remember:
Where Variables Are Declared Variables can be declared in three
places: inside functions, in the definition of function parameters,
and outside of all functions. These positions correspond to local
variables, formal parameters, and global variables, respectively.
Local Variables:
Variables that are declared inside a function are called local
variables Local variables exist only while the block of code in which
they are declared is executing. That is, a local variable is created
upon entry into its block and destroyed upon exit. Furthermore, a
variable declared within one code block has no bearing on or
10. !
"
relationship to another variable with the same name declared
within a different code block.
Global Variables:
Unlike local variables, global variables are known throughout the
program and may be used by any piece of code. Also, they will hold
their value throughout the program's execution. You create global
Variables by declaring them outside of any function. Any expression
may access them, regardless of what block of code that expression
is in.
Variable Initializations:
You can give variables a value as you declare them by placing an
equal sign and a constant after the variable name. The general form
of initialization is type variable_name = constant;
Some examples are
char ch = 'a';
int first = 0;
double balance = 123.23;
Constants:
Constants refer to fixed values that the program may not alter.
Constants can be of any of the basic data types. The way each
constant is represented depends upon its type. Constants are also
called literals.
11. !
"
Escape Sequences:
Code Meaning
b Backspace
f Form feed
n new line
r Carriage return
t Horizontal tab
" Double quote
' Single quote
Backslash
v Vertical tab
a Alert
? Question mark
N octal constant (where N is an octal constant)
xN Hexadecimal constant (where N is a hexadecimal constant)
Operators
C is very rich in built-in operators. In fact, it places more significance on operators
than do most other computer languages. There are four main classes of operators:
arithmetic, relational, logical, and bitwise. In addition, there are some special
operators, such as the assignment operator, for particular tasks
1) The Assignment Operator
You can use the assignment operator within any valid expression the general form
of the assignment operator is: variable name = expression; where an expression
may be as simple as a single constant or as complex as you require.
a) Multiple Assignments
You can assign many variables the same value by using multiple assignments in a
single statement. For example, this program fragment assigns x, y, and z the value
0:
12. !
"
x = y = z = 0; in professional programs, variables are frequently assigned common
values using this method.
b) Compound Assignments
There is a variation on the assignment statement, called compound assignment. that
simplifies the coding of a certain type of assignment operations. For example,
x = x+10; can be written as x += 10;
The operator += tells the compiler to assign to x the value of x plus 10.
Compound assignment operators exist for all the binary operators (those that
require two operands).In general, statements like
a) var = var operator expression
Can be rewritten as
a) var operator = expression
For another example,
x = x-100;
is the same as x -= 100;
Because compound assignment is more compact than the corresponding =
equivalent, compound assignment is also sometimes referred to as shorthand
assignment. Compound assignment is widely Used in professionally written C
programs; you should be familiar with it.
2) Arithmetic Operators
Table: lists C's arithmetic operators. The operators +, –, *, and / work as they do in
most other computer languages. You can apply them to almost any built-in data
type. When you apply / to an integer or character, any remainder will be truncated.
For example, 5/2 will equal 2 in integer division. The modulus operator % also
works in C as it does in other languages, yielding the remainder of an integer
division. However, you cannot use it on floating-point types. The following code
fragment illustrates %:
Operator Action
– Subtraction, also unary minus
+ Addition
* Multiplication
/ Division
13. !
"
% Modulus
–– Decrement
++ Increment
3) Increment and Decrement Operators
C includes two useful operators that simplify two common operations. These are
the increment and decrement operators, ++ and ––. The operator ++ adds 1 to its
operand, and ––subtracts 1. In other words:
x = x+1; is the same as ++x;
And x = X–1; is the same as x– –;
Both the increment and decrement operators may either precede (prefix) or follow
(postfix) the operand. For example,
x = x+1; can be written ++x; or x++;
There is, however, a difference between the prefix and postfix forms when you use
these operators in a larger expression. When an increment or decrement operator
precedes its operand, the increment or decrement operation is performed before
obtaining the value of the operand for use in the expression. If the operator follows
its operand, the value of the operand is obtained before incrementing or
decrementing it. For instance.
x = 10;
y = ++x;
Sets y to 11. However, if you write the code as
x = 10;
y = x++;
y is set to 10. Either way, x is set to 11; the difference is in when it happens. Most
C compilers produce very fast, efficient object code for increment and decrement
operations code that is better than that generated by using the equivalent
assignment statement. For this reason, you should use the increment and decrement
operators when you can. Here is the precedence of the arithmetic operators: Here is
the precedence of the arithmetic operators:
Highest ++ ––
– (unary minus)
14. !
"
* / %
Lowest + –
Operators on the same level of precedence are evaluated by the compiler from left
to right. Of course, you can use parentheses to alter the order of evaluation. C
treats parentheses in the same way as virtually all other computer languages.
Parentheses force an operation, or set of operations, to have a higher level of
precedence.
4) Logical Operators
In the term relational operator, relational refers to the relationships that values can
have with one another. In the term logical operator, logical refers to the ways these
relationships can be connected. Because the relational and logical operators often
work together, they are discussed together here. The idea of true and false
underlies the concepts of relational and logical operators. In C, true is any value
other than zero. False is zero. Expressions that use relational or logical operators
return 0 for false and 1 for true.
Table shows the relational and logical operators. The truth table for the logical
operators is shown here using 1's and 0's.
p q p && q p || q !p
0 0 0 0 1
0 1 0 1 1
1 1 1 1 0
1 0 0 1 0
5) Relational Operators
Operator Action
> Greater than
>= Greater than or equal
< Less than
<= Less than or equal
= = Equal
15. !
"
!= Not equal
Logical Operators
Operator Action
&& AND
| | OR
! NOT
Table: Relational and Logical Operators
The following table shows the relative precedence of the relational and logical
operators:
Highest!
> >= < <=
= = !=
&&
Lowest | |
As with arithmetic expressions, you can use parentheses to alter the natural order
of evaluation in a relational and/or logical expression. For example,! 0&&0 | | 0
Is false. However, when you add parentheses to the same expression, as shown
here, the result is true.
Remember, all relational and logical expressions produce a result of either 1 or 0.
Therefore, the following program fragment is not only correct, but will print the
number 1.
The following table shows the relative precedence of the relational and logical
operators:
As with arithmetic expressions, you can use parentheses to alter the natural order
of evaluation in a relational and/or logical expression. For example, is false.
However, when you add parentheses to the same expression, as shown here, the
result is true. Remember, all relational and logical expressions produce a result of
either 1 or 0. Therefore, the following program fragment is not only correct, but
will print the number 1.
6) Bitwise operators :
16. !
"
Unlike many other languages, C supports a full complement of bitwise operators.
Since C was designed to take the place of assembly language for most
programming tasks, it needed to be able to support many operations that can be
done in assembler, including operations on bits. Bitwise operation refers to testing,
setting, or shifting the actual bits in a byte or word, which correspond to the
standard char and int data types and variants.
Highest!
> >= < <=
= = !=
&&
The bitwise AND, OR, and NOT (one's complement) are governed by the same
truth table as their logical equivalents, except that they work bit by bit. The
exclusive OR has the truth table shown here:
p q p ^q
0 0 0
1 0 1
1 1 0
0 1 1
- As the table indicates, the outcome of an XOR is true only if exactly one of
the operands is true; otherwise, it is false.
- Bitwise operations most often find application in device drivers— such as
modem programs, disk file routines, and printer routines— because the
bitwise operations can be used to mask off certain bits, such as parity. (The
parity bit confirms that the rest of the bits in the byte are unchanged. It is
often the high-order bit in each byte.)
-
Operator Action
& AND
| OR
^ Exclusive OR (XOR)
~ One's complement (NOT)
17. !
"
>> Shift right
<< Shift left
Table: Bitwise Operators
Example:
#include<stdio.h>
#include<conio.h>
Void main ()
{
Char ch;
Int x=127, y;
Y=ch&x;
Printf(“%d”,y);}
Output:
Parity is often indicated by the eighth bit, which is set to 0 by ANDing it with a
byte that has bits 1through 7 set to 1 and bit 8 set to 0. The expression ch & 127
means to AND together the bits in ch with the bits that make up the number 127.
The net result is that the eighth bit of ch is set to 0. In the following example,
assume that ch had received the character A and had the parity bit set:
The bitwise OR, as the reverse of AND, can be used to set a bit. Any bit that is set
to 1 in either operand causes the corresponding bit in the outcome to be set to 1.
For example, the following is 128 | 3:
An exclusive OR, usually abbreviated XOR will set a bit on, if and only if the bits
being compared are different. For example, 127 ^120 is
18. !
"
Remember, relational and logical operators always produce a result that is either
true or false, whereas the similar bitwise operations may produce any arbitrary
value in accordance with the specific operation. In other words, bitwise operations
may produce values other than 0 or 1, while logical operators will always evaluate
to 0 or 1.The bit-shift operators, >> and <<, move all bits in a variable to the right
or left as specified. The general form of the shift-right statement is
- variable >> number of bit positions
The general form of the shift-left statement is
- variable << number of bit positions
- As bits are shifted off one end, zeroes are brought in the other end. (In the
case of a signed, negative integer, a right shift will cause a 1 to be brought in
so that the sign bit is preserved.) Remember, a shift is not a rotate. That is,
the bits shifted off one end do not come back around to the other. The bits
shifted off are lost.
- Notice that a sequence of two complements in a row always produces the
original number. Hence, the first complement represents the coded version
of that byte. The second complement decodes the byte to its original value.
- unsigned char x; x as each statement executes value of x
- x = 7; 00000111 7
- x = x<<l; 00001110 14
- x = x<<3; 01110000 112
- x = x<<2; 11000000 192
- x = x>>l; 01100000 96
- x = x>>2; 00011000 24
- Each left shift multiplies by 2. Notice that information has been lost after
x<<2 because a bit was shifted off the end.
- Each right shift divides by 2. Notice that subsequent divisions do not bring
back any lost bits.
7) Ternary operator:
19. !
"
C contains a powerful and convenient operator that replaces certain statements of
the if-then-else form. The ternary operator? Takes the general form
Syntax: Exp1? Exp2: Exp3;
Where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the
Colon.
- The? Operator works like this: Exp1 is evaluated. If it is true, Exp2 is
evaluated and becomes the value of the expression. If Exp1 is false, Exp3 is
evaluated, and its value becomes the value of the expression.
For example, in x = 10;
y = x>9? 100: 200;
Y is assigned the value 100. If x had been less than 9, y would have received the
value 200. The same code written using the if-else statement is
x = 10;
If (x>9) y = 100;
Else y = 200;
The? Operator will be discussed more fully in Chapter 3 in relationship to the other
conditional statements.
8) The Comma Operator
The comma operator strings together several expressions. The left side of the
comma operator is always evaluated as void. This means that the expression on the
right side becomes the value of the total comma-separated expression. For
example, x = (y=3, y+1);
First assigns y the value 3 and then assigns x the value 4. The parentheses are
necessary because the comma operator has a lower precedence than the assignment
operator.
Essentially, the comma causes a sequence of operations. When you use it on the
right side of an assignment statement, the value assigned is the value of the last
20. !
"
expression of the comma-separated list. The comma operator has somewhat the
same meaning as the word "and" in English, as used in the phrase "do this and this
and this."
Order of Evaluation
Precedence of C Operators
C does not specify the order in which the sub expressions of an expression are
evaluated. This leaves the compiler free to rearrange an expression to produce
more
Highest ( ) [ ] –>.
! ~ ++ –––(type) * & size of
* / %
+ –
<< >>
< <= > >=
== !=
&
^
|
&&
| |
?: = += –= *= /= etc.
Control Statement
There are four types of control statements
1) Selection Control Statement (Switch-Case)
2) Decision Making Control Statement (if, if-else, if-else-if ladder)
3) Iteration Control Statement (While, Do-While, For)
4) Jump Control Statement (Go to, Continue, Break)
21. !
"
I. Selection Control Statement: C supports two selection
statements: if and switch. In addition, the ? Operator is an alternative to if
in certain circumstances.
If:
The general form of the if statement is
if (expression) statement;
else statement;
Switch- Case Statement:
C has a built-in multiple-branch selection statement, called switch, which
successively tests the value of an expression against a list of integer or character
constants. When a match is found, the statements associated with that constant are
executed. The general form of the switch statement is
switch (expression)
{
case constant1:
statement sequence
break;
case constant2:
statement sequence
break;
case constant3:
statement sequence
break;
.
.
.
default
statement sequence
}
- Note: The expression must evaluate to an integer type. Thus, you can use
character or integer values, but floating-point expressions, for example, are
22. !
"
not allowed. The value of expression is tested against the values, one after
another, of the constants specified in the case statements. When a match is
found, the statement sequence associated with that case is executed until the
break statement or the end of the switch statement is reached. The default
statement is executed if no matches are found. The default is optional, and if
it is not present, no action takes place if all matches fail.
- The break statement is one of C's jump statements. You can use it in loops
as well as in the switch statement (see the section ''Iteration Statements").
When break is encountered in a switch, program execution "jumps" to the
line of code following the switch statement.
There are three important things to know about the switch statement:
I. The switch differs from the if in that switch can only test for equality,
whereas if can evaluate any type of relational or logical expression.
II. No two case constants in the same switch can have identical values. Of
course, a switch statement enclosed by an outer switch may have case
constants that are in common.
III. If character constants are used in the switch statement, they are
automatically converted to integers (as is specified by C's type conversion
rules).
II. Decision Making Statement:
A) Nested ifs
A nested if is an, if that is the target of another if or else. Nested ifs are very
common in programming. In a nested if, an else statement always refers to the
nearest if statement that is within the same block as the else and that is not already
associated with an else
SYNTAX:
23. !
"
if(i)
{
if(j) dosomething1();
if(k) dosomething2(); /* this if */
else dosomething3(); /* is associated with this else */
}
else dosomething4(); /* associated with if(i) */
B) The if-else-if Ladder
A common programming construct is the if-else-if ladder, sometimes called the if-
else-if staircase because of its appearance. Its general form is
if (expression) statement;
else
if (expression) statement;
else
if (expression) statement;
.
.
.
else statement;
III. Iteration Statements:
In C, and all other modern programming languages, iteration statements (also
called loops) allow a set of instructions to be repeatedly executed until a certain
condition is reached. This condition may be predetermined (as in the for loop) or
open ended (as in the while and do-while loops).
A) The for Loop
The general design of the for loop is reflected in some form or another in all
procedural programming languages. However, in C, it provides unexpected
flexibility and power. The general form of the for statement is
SYNTAX: For (initialization; condition; increment) statement;
24. !
"
Q. In the following program, a for loop is used to print the numbers 1 through 100
on the screen:
Example: #include <stdio.h>
int main(void)
{
int x;
for(x=1; x <= 100; x++)
printf("%d ", x);
return 0;
}
Explanation: In the loop, x is initially set to 1 and then compared with 100. Since
x is less than 100, printf ( ) is called and the loop iterates. This causes x to be
increased by 1 and again tested to see if it is still less than or equal to 100. If it is,
printf ( ) is called. This process repeats until x is greater than 100, at which point
the loop terminates. In this example, x is the loop control variable, which is
changed and checked each time the loop repeats.
B) The while Loop
The second loop available in C is the while loop.
Its general form is:
While (condition)
{
Statement;
}
Where statement is an empty statement, a single statement, or a block of
statements. The condition may be any expression, and true is any nonzero value.
The loop iterates while the condition is true. When the condition becomes false,
program control passes to the line of code immediately following the loop.
C) The do-while Loop
25. !
"
Unlike for and while loops, which test the loop condition at the top of the loop, the
do-while loop checks its condition at the bottom of the loop. This means that a do-
while loop always executes at least once.
The general form of the do-while loop is:
Do
{
Statement;
}
While (condition);
Although the curly braces are not necessary when only one statement is present,
they are usually used to avoid confusion (to you, not the compiler) with the while.
The do-while loop iterates until condition becomes false.
Q. The following do-while loop will read numbers from the keyboard until it finds
a number less than or equal to 100:
Do
{
scanf(''%d", &num);
}
while(num > 100);
IV: Jump Statements
C has four statements that perform an unconditional branch: return, go to, break,
and continue. Of these, you can use return and go to anywhere inside a function.
You can use the break and continue statements in conjunction with any of the loop
statements. As discussed earlier in this chapter, you can also use break with switch.
The return Statement
The return statement is used to return from a function. It is categorized as a jump
statement because it causes execution to return (jump back) to the point at which
the call to the function was made. A return may or may not have a value associated
with it. A return with a value can be used only in a function with a non-void return
26. !
"
type. In this case, the value associated with return becomes the return value of the
function. A return without a value is used to return from a void function.
The general form of the return statement is:
Return expression;
The go to statement:
It requires a label for operation. (A label is a valid identifier followed by a
colon.)Furthermore, the label must be in the same function as the go to that uses
it— you cannot jump between functions.
The general form of the go to statement is
Go to label;
...
Label:
Where label is any valid label either before or after go to.
For example, you could create a loop from 1 to 100 using the go to and a label, as
shown here:
x = 1;
loop1:
x++;
if(x <= 100) go to loop1;
The break Statement:
The break statement has two uses. You can use it to terminate a case in the switch
statement (covered in the section on switch earlier in this chapter). You can also
use it to force immediate termination of a loop, bypassing the normal loop
conditional test. When the break statement is encountered inside a loop, the loop is
immediately terminated, and program control resumes at the next statement
following the loop. For example,
#include <stdio.h>
int main (void)
{
int t;
for(t=0; t < 100; t++) {
27. !
"
printf(''%d ", t);
if(t == 10) break;
}
return 0;}
The continue Statement
The continue statement works somewhat like the break statement. Instead of
forcing termination, however, continue forces the next iteration of the loop to take
place.
Block Statements
Block statements are simply groups of related statements that are treated as a unit.
The statements that make up a block are logically bound together. Block
statements are also called compound statements. A block is begun with a {and
terminated by its matching}. Programmers use block statements most commonly
to create a multi statement target for some other statement, such as if. However,
you may place a block statement anywhere you would put any other statement. For
Example, this is perfectly valid (although unusual) C code: