#1
June 8th, 2016, 03:31 PM
| |||
| |||
IIT Madras ECE Notes
Hi I would like to have the lecture notes for the C language in the Computer Programming subject for the ECE discipline for the IIT, Madras? the lecture notes for the C language in the Computer Programming subject for the ECE discipline for the IIT, Madras has been mentioned below: Introduction u The C Language Elements Comments /* This is a comment. A set of any characters */ Identifiers Variable_Name_2 Keywords are reserved if, for, while u Basic Data Types char (0:255, -128:127) int float double short int short long int long long double unsigned int signed char unsigned long int u Literals Integer constants 1234, 234l, 534L, 67u, 1092UL Floating point number constants 154.3, 23e-43, 231.0L 154.3f, 23e-4F Octal constants 077 Hexadecimal constants 0xAE77, 0X12 Strings "any text in quotas" Character constants 'A', '\x41', '\101', 65, '\0' special characters: \a, \b, \f, \n, \r, \t, \v, \\, \?, \', \" u Defining a constant with a preprocessor directive #define DIMENSION 10 Operators u Arithmetic: +, *, /, -, % (modulo only for positive integers) u Relational: >, >=, <, <=, ==, != give results equal to 1(TRUE) or 0 (FALSE) u Logical: && (and), || (or) - Evaluated always from left hand side until the result is determined ! (not). u Casting: int i = (int) (2.5 * 3.61); u Incrementation and decrementation: ++, --int i, j; i = 7; j = i++; j = ++i; u Bit operators: & (and), | (or), ^ (exor), << (shift left), >> (shift right), ~ (one's complement). The C Programming Language (Lecture Notes) 4 The C Programming Language - Lecture Notes p. 7 u Assignment: =, op= (op: +, -, *, /, %, >>, <<, &, |, ^) i = 5 i = j = 6 /* i = (j = 6) */ i -=2 /* i = i - 2 */ i += j = 4 /* i += (j = 4) */ u Conditional operator: expression1? expression2 : expression3 c = (a > b) ? a : b u Operator , (comma) i = (j=5, ++j) u Priorities and evaluation order Table of priorities and associativness of operators Priorities of operators in expressions can be defined (changed) by parenthesis i = (2 + 3) * 16 u Only for the following operators: &&, ||, , (comma) and conditional operator the evaluation order is defined from the left hand side to the right hand side. For all other operators the evaluation order is not defined (and is implementation dependent). The C Programming Language - Lecture Notes p. 8 u Example OP.1 int i = 8, j = 2; i = ++j * j++; /* i = 8 ? i = 9 ? */ u Example OP.2 int i = 0, j = 0, k = 0; i++ && j++ || k++; C language not for Computer Programming for IIT For further notes the file has been attached in the file below: Last edited by Neelurk; June 26th, 2020 at 04:40 PM. |
|