Where can I find PDFs of the book Python Programming by Reema Thareja? Go to a site called PDF Drive - Search and download PDF files for free. There you . Computer Fundamentals and Programming in c by Reema Thareja - Download as PDF File .pdf), Text File .txt) or read online. For beginners. The book starts with an introduction to programming in general followed by a detailed introduction to C programming. It then delves into a.
|Language:||English, Spanish, French|
|Genre:||Health & Fitness|
|ePub File Size:||15.33 MB|
|PDF File Size:||16.23 MB|
|Distribution:||Free* [*Sign up for free]|
Department of Computer Science. Shyama Prasad Mukherjee College for Women. University of Delhi. Reema Thareja. Second Edition. Data Structures. Using c. Data amp File Structures Using C gtu Reema Thareja. Data warehousing reema thareja pdf. causes or aids a person to commit or engage in prostitution. Data Structures c Using Second Edition Reema Thareja Assistant Professor Department of Computer Science Shyama Prasad Mukherjee College for Women .
Reema Thareja Paperback 23 Feb Pages. Description Computer Fundamentals and Programming in C is designed to serve as a textbook for the undergraduate students of engineering, computer science, computer applications, and information technology. The book provides a thorough overview of all the fundamental concepts related to computer science and programming. Beginning with an introduction to computers, the book offers a detailed account of various topics covered in computer fundamentals ranging from the evolution and characteristics of computers, description of latest software technologies, and the Internet, to the basics of C programming along with an introduction of important data structures. Written in lucid language, the book provides several pedagogical features including numerous case studies, plenty of well-labelled illustrations, key terms, and end-chapter exercises. Text is interspersed with notes that provide additional but relevant information and programming tips that will help students avoid common programming errors.
Constants are used to define fixed values like pi or the charge on an electron so that their value does not get changed in the program even by mistake. Declaring Constants To declare a constant, precede the normal variable declaration with const keyword and assign it a value. For that, open a text editor. This file has some in-built functions.
By simply including this file in our code, we can use these functions directly. After all the statements in the program have been executed, the last statement of the program will return an integer value to the operating system.
The concepts will be clear to us when we read this chapter in toto. So even if you do not understand certain things, do not worry. Note Every statement in the main function ends with a semi-colon ;.
If you leave out the —o, then the file name a. If there are any mistakes in the program, then the compiler will tell you what mistake s you have made and on which line the error has occurred.
In case of errors, you need to re-open your. However, if everything is right, then no error s will be reported and the compiler will create an. That is, Welcome to the world of C Note The printf and return statements have been indented or moved away from the left side. This is done to make the code more readable. Using Comments Comments are a way of explaining what a program does. C supports two types of comments. Note that comment statements are not executed by the compiler.
Rather, they are ignored by the compiler as they are simply added in programs to make the code understandable by programmers as well as other users. It is a good habit to always put a comment at the top of a program that tells you what the program does. This helps in defining the usage of the program the moment you open it.
Standard Header Files Till now we have used printf function, which is defined in the stdio. Even in other programs that we will be writing, we will use many functions that are not written by us. For example, to use the strcmp function that compares two strings, we will pass string arguments and retrieve the result. We do not know the details of how these functions work.
Such functions that are provided by all C compilers are included in standard header files. As shown in Section 1. This is done by using the scanf function that reads data from the keyboard. Similarly, for outputting results of Introduction to C 7 the program, printf function is used that sends results to a terminal.
Like printf and scanf, there are different functions in C that can carry out the input—output operations. That is, it indicates that data should be read from the stream but ignored not stored in the memory location. However, if the scanf function encounters a white space or an unconvertible character, input is terminated. Modifier h is used for short int or unsigned short int, l is used for long int, unsigned long int, or double values. Finally, L is used for long double data values.
It also indicates how this data is expected to be read from the user. The type specifiers for scanf function are given in Table 1. The function simply returns the number of input fields successfully scanned and stored. As we have not studied functions till now, understanding scanf function in depth will be a bit difficult here, but for now just understand that the scanf function is used to store values in memory locations associated with variables.
For this, the function should have the address of the variables. The control string contains format specifiers which are arranged in the order so that they correspond with the arguments in the variable list.
It may also contain text to be printed such as instructions to the user, identifier names, or any other text to make the text readable. Note that there must be enough arguments because if there are not enough arguments, then the result will be completely unpredictable. However, if by mistake you specify more number of arguments, the excess arguments will simply be ignored.
If the number of output characters is smaller than the specified width, then the output would be right justified with blank spaces to the left.
However, if the number of characters is greater than the specified width, then all the characters would be printed. The type specifiers for printf function are given in Table 1.
Arithmetic operators can be applied to any integer or floating point number. This operator can be applied only on integer operands and cannot be used on float or double operands. While performing modulo division, the sign of the result is always the sign of the first operand the dividend. Integer division always results in an integer result. So, the result is always rounded-off by ignoring the remainder. This is an illegal operation that results in a run-time division-by-zero exception thereby terminating the program.
If both operands are integers, the result will be an integer; if one or both operands are floating point numbers then the result would be a floating point number. All the arithmetic operators bind from left to right. Multiplication, division, and modulus operators have higher precedence over addition and subtraction operators. Thus, if an arithmetic expression consists of a mix of operators, then multiplication, division, and modulus will be carried out first in a left to right order, before any addition and subtraction can be performed.
Relational operators return true or false value, depending on whether the conditional relationship between the two operands holds or not. C provides four relational operators which are illustrated in Table 1. Equality Operators C language also supports two equality operators to compare operands for strict equality or inequality. The equality operators have lower precedence than the relational operators. On the contrary, the not- equal, 0 otherwise equal-to operator!
Logical Operators C language supports three logical operators. As in case of arithmetic expressions, logical expressions are evaluated from left to right. If both the operands are true, 0 1 0 then the whole expression is true. If both or one of the operands is 1 0 0 false, then the whole expression evaluates to false. The truth table 1 1 1 of logical AND operator is given in Table 1.
Logical OR Table 1. A B A B Otherwise it returns a true value. The truth table of logical OR 0 0 0 operator is given in Table 1.
Logical NOT! A 1 if the expression produces a zero. The truth table of logical NOT 0 1 operator is given in Table 1. The value of! Unary Operators Unary operators act on single operands. C language supports three unary operators. They are unary minus, increment, and decrement operators. Unary Minus — Unary minus operator negates the value of its operand. For example, if a number is positive then it becomes negative when preceded with a unary minus operator.
Similarly, if the number is negative, it becomes positive after applying the unary minus operator. After applying unary minus operator — on the operand b, the value becomes —10, which indicates it has a negative value.
Similarly, the decrement operator decreases the value of its operand by 1.
Similarly, — —x is not the same as x——. Whereas in the latter case, the value of x is returned after it is incremented. Note that unary operators have a higher precedence than the binary operators.
And if in an expression we have more than one unary operator then they are evaluated from right to left. Conditional Operator The syntax of the conditional operator is exp1?
If it is true, then exp2 is evaluated and becomes the result of the expression, otherwise exp3 is evaluated and becomes the result of the expression. Hence, large is equal to either a or b, but not both.
Conditional operators make the program code more compact, more readable, and safer to use as it is easier to both check and guarantee the arguments that are used for evaluation.
Conditional operator is also known as ternary operator as it takes three operands. Bitwise Operators As the name suggests, bitwise operators perform operations at the bit level. When we use the bitwise AND operator, the bit in the first operand is ANDed with the corresponding bit in the second operand. The truth table is the same as we had seen in logical AND operation. The bitwise AND operator compares each bit of its first operand with the corresponding bit of its second operand.
If both bits are 1, the corresponding bit in the result is 1 and 0 otherwise. The truth table is the same as we had seen in logical OR operation. The bitwise OR operator compares each bit of its first operand with the corresponding bit of its second operand. If one or both bits are 1, the corresponding bit in the result is 1 and 0 otherwise. The truth table of bitwise XOR operator is shown in Table 1. If one of the bits is 1, the corresponding bit in the result 0 1 1 is 1 and 0 otherwise.
Bitwise NOT operator sets the bit to 1 if it was initially 0 and sets it to 0 if it was initially 1. When an equal sign is encountered in an expression, the compiler processes the statement on the right side of the sign and assigns the result to the variable on the left side. The assignment operator has right-to-left associativity, so the expression 14 Data Structures Using C Table 1. This operator can be applied to all data types. When using this operator, the keyword sizeof is followed by a type name, variable, or expression.
The operator returns the size of the data type, variable, or expression in bytes. When a type name is used, it is enclosed in parentheses, but in case of variable names and expressions, they can be specified with or without parentheses. A sizeof expression returns an unsigned value that specifies the size of the space in bytes required by the data type, variable, or expression.
For example, sizeof char returns 1, that is the size of a character data type. Since a is an integer, it requires 2 bytes of storage space. Operator precedence Chart Table 1. The associativity indicates the order in which the operators of equal precedence in an expression are evaluated.
Introduction to C 15 Table 1. Write a program to calculate the area of a circle. While type conversion is done implicitly, casting has to be done explicitly by the programmer. We will discuss both these concepts here.
Type Conversion Type conversion is done when the expression has variables of different data types. So to evaluate the expression, the data type is promoted from lower to higher level where the hierarchy of data types can be given as: double, float, long, int, short, and char.
For example, type conversion is automatically done when we assign an integer value to a floating point variable. Typecasting Typecasting is also known as forced conversion. It is done when the value of one data type has to be converted into the value of another data type.
Therefore, data is lost when floating point representations are converted to integral representations. As we can see in the code, typecasting can be done by placing the destination data type in parentheses followed by the variable name that has to be converted.
Hence, we conclude that typecasting is done to make a variable of one data type to act like a variable of another type. Programming ExamPlE 2. Write a program to convert an integer into the corresponding floating point number.
That is, the second statement is executed after the first, the third statement is executed after the second, so on and so forth. Although this is true, in some cases we want only selected statements to be executed.
Control flow statements enable programmers to conditionally execute a particular block of code. There are three types of control statements: decision control branching , iterative looping , and jump statements. While branching means deciding what actions have to be taken, looping, on the other hand, decides how many times the action has to be taken. Jump statements transfer control from one point to another point.
These statements help to jump from one part of the program to another depending on whether a particular condition is satisfied or not. These decision control statements include: a if statement, b if—else statement, c if—else—if statement, and d switch—case statement. The general form of a simple if statement is shown in Fig. First the test expression is evaluated. If the test expression is true, the statements of the if block are executed, otherwise these statements will be skipped and the execution will jump to statement x.
The statement in an if block is any valid C language statement, and the test expression is any valid C language expression that evaluates to either true or false. In addition to simple relational expressions, we can also use compound expressions formed using logical operators. Note that there is no semi-colon after the test expression. This is because the condition and statement should be put together as a single statement.
In the test expression, we check if the value of x is greater than 0. After that, the value of x is printed on the screen.
Note In case the statement block contains only one statement, putting curly brackets becomes optional. If there are more than one statement in the statement block, putting curly brackets becomes mandatory. Its usage is very simple. The test expression is evaluated, if the result is true, the statement s followed by the expression is executed, else if the expression is false, the statement is skipped by the compiler.
What if you want a separate set of statements to be executed if the expression returns a false value? In such cases, we can use an if—else statement rather than using a simple if statement.
The general form of simple if—else statement is shown in Fig. If the expression is true, statement block 1 is executed and statement block 2 is skipped. Otherwise, if the expression is false, statement block 2 is executed and statement block 1 is ignored.
In any case after the statement block 1 or 2 gets executed, the control will pass to statement x. Therefore, statement x is executed in every case. Write a program to find whether a number is even or odd. The if—else—if construct works in the same way as a normal if statement. Its construct is given in Fig. After the first test expression or the first if branch, the programmer can have as many else—if branches as he wants depending on the expressions that have to be tested.
For example, the following code tests whether a number entered by the user is negative, positive, or equal to zero.
The general form of a switch statement is shown in Fig. Switch statements are also used to handle the input given by the user.
We have already seen the syntax of the switch statement. The switch case statement compares the value of the variable given in the switch statement with the value of each case statement that follows. When the value of the switch and the case statement matches, the statement block of that particular case is executed.
Did you notice the keyword default in the syntax of the switch case statement? Default is the case that is executed when the value of the variable does not match with any of the values of the case statements. That is, default case is executed when no match is found between the values of switch and case statements and thus there are no statements to be executed.
Although the default case is optional, it is always recommended to include it as it handles any unexpected case. In the syntax of the switch—case statement, we have used another keyword break. The break statement must be used at the end of each case because if it is not used, then the case that matched and all the following cases will be executed.
For example, if the value of switch statement matched with that of case 2, then all the statements in case 2 as well as the rest of the cases including default will be executed. The book starts with an introduction to C programming and then delves into an in-depth analysis of various constructs of C.
The key topics include iterative and decision-control statements, functions, arrays, strings, pointers, structures and unions, file management, and pre-processor directives.
It deals separately with the fundamental concepts of various data structures such as linked lists, stacks, queues, trees, and graphs. The book provides numerous case studies linked to the concepts explained in the text. With its highly detailed pedagogy entailing examples, figures, algorithms, programming tips, and exercises, the book will serve as an ideal resource for students to master and fine-tune the art of writing efficient C programs.
Read More Table of contents Chapter 1. Introduction to programming Chapter 2. Introduction to c Chapter 3. Decision control and looping statements Chapter 4.
Functions Chapter 5. Arrays Chapter 6.