Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
360 views
118 pages
C LANGUGEe
hfjef
Uploaded by
Abcxyz Xyzabc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save C LANGUGEe For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
360 views
118 pages
C LANGUGEe
hfjef
Uploaded by
Abcxyz Xyzabc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save C LANGUGEe For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save C LANGUGEe For Later
You are on page 1
/ 118
Search
Fullscreen
KIT? Kalyan [T Trang Hyderabad pvt.Itd. C programmingIT Tawining Pat, Lat, #202, MAHENDRA RESIDENCY, 3° BULDING FROM ADITYA TRADE CENTER, AMEERPET, HYD-18, CON. No.-9704177700, 7032300891 C«DS By Mu. Kalyan Reddy Ph: 040-6662 2789, 6662 3789 www.kalyanit.comKabyan IT Training (yd) Pvt Led C PROGRAMMING AND DATA STRUCTURES unit ‘Algortha pseudo code, flowchart, program development steps, structure of C program, A Simple C program, identiers, basic data types and sizes, Constants, varlables, artmetic, Felatona and logical operators, increment and decrement operators, conditional opefator, bi ‘wise operators, assignment operators, expressions, type conversions, condilnal expressions, precedence and order of evaluation. input-output statements, statements and blocks, If and Switch statements, loops- while, do-nhilo and for statements, break, continue, glo and labels, programming examples uNir—11 Designing structured programs, Functions, basics, parameter passing, storage classes- extern, ‘auto, register, static, scope rules, block structure, user defined functions. standard litany {unclons, recursive functions, header fs, C preprocessor, example c programe, unit ‘Arrays- concepts, dovaration, defniton, accessing elements, string elements, arrays and functions, two dimensional and mult-dimensional arrays, applications of arrays. pointers- concepts, ntalzation of poinior variables, pointers and function arguments, address athmeti, ‘Character pointars and functions, pointers to pointers, pointers and multikmensional array, dynamic memory managements functions, command in arguments, c program examples, uNit-w Derived types- structues- dactaration, definition and inialzation of structures, accessing iructures, nested structures, arrays of structures, structures and functions, pointers ‘tucture, self referential structures, unions, typede, bites, C program examples, unr v Inout and output ~ concept of fle, tex fies and binary fles, streams, standard Uo, Formatted No, fle VO operations, erorhanaling,C program examples. TEXT BOOKS: 4. Computer science, A structured programming approach using C, B.A. Forouzan and RLF. Giborg Third ection, Thomson, 2, DataSiructures Using C ~ A.S.Tanenbaum, Y, Langsam, and M.J. Augenstein, PHUPearson education. REFERENCES 1. C& Data structures - P. Padmanatham, B.S. Publications. 2, The C Programming Language, RW Kernighan, Dannis M Ritchie, PHUPearsen Education 3. C Programming with problem song, LA, Jones & K, Harrow, dreamlach Press 4. Programming in C ~ Stephen G. Kochan, Il Edition, Pearson Edutaion, sexe aanicom Phi: 040-6662 2789, 6662 3789WT Teminving Pit, Lé., #202, MAHENORA RESIDENCY, 3° BUILDING FROM ADITYA TRADE CENTER, AMEERPET, HyD-16 UNIT -1 C&DS By Mv. Kalyan Reddy Ph: 040-6662 2789, 6662 3789 www.kalyanit.com+ Kabyan IT Training (Hyd) Pot Led UNIT=1 Tonic. Aigorithm Flow chart Program execution steps Structure of C progam Choracteristes of C Token, Keywords Character set, delimiters, identifies, variables Dota types Constants Type conversion, operators Expressions VO's, Statements Hebe Coneitional operator Switch statement Goto Loops Break ~ continue n uv 7 8 a a 2 23 wus kabjanitcom Ph 040.6662 2789, 6662 3789. Katyn I Training Gd) ve Led Algorithm {an algorithm is a method of representing the step-by-step procedure for solving a problem using @ pseudo cade. An algorithm Is defined as o finite set of steps that provide & chain of actions for solving a definite nature of problem, Pseudo-code Pseudo code is an artical and Informal language that helps programmers develops ‘algorithms. Algorithms written in English like language are called peudo-code, x: Average of three numbers ead a,b,c Sum abe Dive stm by 3 Store result in & Pane [End program, - ‘Steps in algorithm: Steps In algorithm can be divided Into three categories. {2 Sequence B Selection © eration 18, Sequence: The steps described in an algorithm are performed successively one by ‘one without skipping any step. The sequence of steps defined In an algorithm should be simple and easy to understand. Each instruction of such an algorithm is executed, because no selection procedure or conditional branching exists Ina, sequence algoriti, i 4. Dal the phone number 2. Phone rings a the called party 3. caller wats for response, 4: Called party picks up the phone. 5. Conversation begins between them. 6. Release of connection, ». Selection: The disadvantage with sequence algorithm Is not reliable, There must bbe a procedure to handle operation failure occurring during execution. The selection statement canbe 25! if (condition) statement 1 flee statement2; Ex: 1, Dial phone number: If (busy tone) Goto steps 2. Phone rings a the called party 3. Caller wats for 1 response. www abyanit com Ph: 040-6662 2789, 6662 3789Ee eee ee Kalyan IT Training (Hyd) Pvt Led 4. Caled party picks up the phone, 5: Conversation begins between them, 6. Release of connection. ‘The selection block handles the situation and run-time failures can be avoided. . Iteration: In a program sometimes itis very necessary to perform the same ‘action for 8 number of times. Ifthe same statement te writen repetitively, it will Increase the program code. To avoid this problem, iteration mechanism fs plied. ‘The statement written in an iteration biock is executed for a given number of times based on certan condition For wile for Expressions; Expression; Expressin2; while (Expression2) Bapression3; € Statement; Statement; Statement; Expression 3; Expression 3; > while (Expression 2); Properti 1 Finiteness 2, Defniteness 5 effectiveness 4 Generalty 5. Input/Output Finiteness: An sigorthm should terminate ina finite no. of steps. Dafinitoness: Each step of algorithm must be precisely stated, Effectiveness: tach step should be easily convertible into program statement and ean be performed exacty in a finite amount of time, Generality: Aigartivn should be complete in itself 50 that it can be used to solve all problems oF a given type for any inp date 1/0: Each algorthm must take zero, one or more quantities as input deta and yield one oF ‘more output values, Flow Cha Flow chart is diagrammatic representation of an algorithm and bult using elfferent types of Boxes end symbols, A flow chart 9 visual representation ofthe sequence of steps for solving @ protiem. & flowchart is an alternative technique for solving problem, Once sn algorithm is written, Its pictorial representation can be done using flowchart symbols, In ‘other words, a pictorial representation ofa textual algorithm is dane using @ Rowena. www §abyanit com Phi 040-6662 2788, 6662 3789Kalyan IT Training (Hyd) Pvt Led FETT) | eens Paton Tron oan [vara sou saan rocobing orcad acer fhe proceed rset Sena em i a = oS a SS eee alters ieee. = ——— ra = ao CERES Se Saw ral —— e : Sane a a a. Editing Bb. Comating © Unking 4. Execution ‘2, Editing: In the editing phase, the C program i entered into a fle though a text tetitor, UNIX OS provides text editor ‘editor, madern compiler vendors provide {bes which consists of bath ecitor and compilers. The fle Is saved or the disk with “extension. Corrections In program at later stages ate done through these editors. (nce program has been written, it requires to be translating into machne language, b, Compiling: This phase Vs caried out by compiler. Compiler translates the source fre into the object code Le. machine understandable code. The complation phase Cannot be proceegee successfully undl ang uness the souree cole Is errorstree. The ‘ampller generates messages if t encounters syntactic erors inthe source code, The teror free souree code Is translated nto object code and stored in a Separate file with ‘Sr extension ob. ‘c Linking! The linker links all the fles and functions with the object code under ‘ececution. For example, if a user uses a "print? function in the program, the linker thnks the User programs object code with the object code ofthe ‘printf function which lein the “sti. library. 1. Execution: Hare, the executable object code [s loaded into the memory and program execution begins. We may encounter errors during the execution phase a www Kabyanit.com (Ph: 040-6662 2783, 6662 5789ee eee ee eee ee eee Kabyan IT Training (Hyd) Pot Led ‘even though compilation phase is successful the errors may be run-time errors and Toaleal errors. ‘Structure of ‘¢’ Program: Trcluge header fe section Global decaration section comments */ ‘mein () {function name ¢ Declaration part Executable part > User defined functions « Declaration port Executable part |. Include header file section: A program depends upon some header files for function definition that are used! in the program, Each header fle by default hos {an extension “iW The file should be induded using ‘include drectve. Bx Bindude
». Global deciaration: This section declares some variables that are used In more than one function. These variables are known as global variables. This secon must be declared ouside of all the functions, {& main() function: Every program written In C language must contain the main() function. Empty parentheses after main are necessary. The function main() is the starting point of every °C" program. The execution of the program elways begins vith the function main). Except the main) funetion, ather sections ray not be necessary. The program execution starts from the Opening brace “and enes ‘ith the closing brace"). Between these two braces, the programmer should eclare declarations and executable parts. 4. Declaration part: The decaration part declares all variables that are used in the executable pert. Initialization of variables is algo done in. this section Intalization means providing inital valve to the variables. fe. Executable part: This par contains the statements following the declaration of the variables. This part contains set of statements or a single statement. These. statements are enclosed between the braces User-defined function: The functions cefned by the user are called user defined functions. These functions are generally defined after the maln() function ‘Tey ‘can also be defined before the main() functor. This portion Is. not compulsory 19 Comments: Comments are not necessary in the program. However, to Understand the flow of the program, programmer can ineude comments if the program. Comments are to be inserted by the programmer. These are useful for | ‘Socumentation wow Ralyanit.com (Ph 040.6662 2780, 6562 3780Kalyan IT Training (Hyd) Pvt Led Characteristics of '¢’: 4, Generality: ‘C' language Is general-purpose languege. It is used to write programs varying from simple to complex. Nowadays, It is used In developing applications \ihich are effectively used in academic campus, multinational companies et. 2, Middle level language: °C" language possess the capabilites of both iow level languages and high level languages. Therefore, C can be used for writing system software’ and application sotware's 3, Extensive library functions: "C’ language has huge set of bul in library functions ‘making ta robust language. Any complex programs can be easily writen using these bult-in functions 4, Effielency and speed: °C’ language has rich set of data types and operators making the language more efficient and fast. The language provides some operators Uincrement, decrement) which speed up the execution to large extent. Further, it flso provides user defined data types (Ex: structures) through which miscellaneous data can be easily manipulated 5, Portability: °C’ language Is portable. It means that the programmes written on one ‘machine can be executed on diferent machine with or without minor changes In the program. 6, Structured programming: A’ program can be defined as a calection af function ‘modules (le, performing a unit of task) and blocks. It also provides basic contrl flow statements which are essential for structured programming, ‘Simple program: The first € program ‘aid main( ) print" WELCOME TO KALYAN IT); > Leaning C is similar and easier, Instead of straight-away learning how to write programs, we must know keywords, operators, separators, constants, predefine funetins ard syntax of C language. ‘Token: The smallest individual units in C program are known as C tokens. C has 6 types oftokens: keywords, constants, Identifiers, strings, special symbols and operators. C programs are written Using thesa tokens and syntax ofthe language. 1. Keywords: Keyword Is the word whose meaning has already been explained to the Ceompler. In ANSI standardizes C language total number of keyworés are 32. xt while If else, case, break, et ie struc long ‘nite register typeder short Unsigned signed void sif volatile static wile www Kebyonitcom Ph: 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Pvt Led 2. Character set: The characters used to form words, numbers and expressions ‘depend upon the computer on which the program runs. These ave cassified into 4 tategories. Ty ones Capt Atoz Smal ato 2 2) Digts A decimal digits 0 10 9 3) White spaces Blank space, horizontal ta, vertical tab, New line, form feed 4) Special characters TNT Ve 8 TRY et=e 3, Delimiters: These are special kind of symbols, which are called 25 delimiters. In ‘general terms these delimiters known as separators. Delimiters Use colon Useful for label Semi colon Terminates statement (parenthesis: Used in expression and function Uy Square bracket Used for array declaration ‘Gently brace ‘Seape of statement hash Pre-processor directive ‘comma Variable separator 4. Constants: The constants in C are applicable to the values, which do not change Surnng the execution of a program. Constants are classified in to two types. 2. Numeric constants Integer constants: Ex: 10, +30, -15 ete. 2. Real constants: Ex: 2.5, 521, 3.14 ete >. Character constants ‘Single character constants: x: a 21 Sting constants: Ex: "Hello", "444", » rete. (Alpha numeric) 5. Identifiers: Identiners are names of variables, functions, and arrays. They are User-defined names, consisting of sequence of letters and digits, wit the letter as the fist character, Lower case letters are preferred. However, the upper case letters fare alsa permitted. The underscore (_) symbol can be used as an identifier. In {General underscore Is used as 2 ink between two words In ong identifiers. Ex: total Salary. 6, Variables: A variable is 2 date name used for storing a data value, Its value may be Changed dunng the program execution. The variables value keeps on changing ‘uring the execution of & program. In other words, a variable can be assigned ‘itferent values at afferent times during the execution of a program. Ex: height, average, sum etc www Kebyanit.com i 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Pot Led 7. Data types: A data type |s essential to Identify the storage representation and the typeof ‘operations that can be performed on that data. In general, data type associated with variable Indicates, ‘+ Type of value stored in the variable. Amount of memory (size) allocated for data variable. 1 Type of operations that can be performed on the variable. °C’ supports four basic data type which can be grouped under two groups of data types. 1, Integral dota type 21 Floating point datatype. 4, Integral Data Type: Integral data type Is used to stored whole numbers and characters. It can be further classification 3, ‘a. Integer data type Bi. Character datatype. ‘a Integer data type: This data type is used to store the whole numbers. The integers 60 not contain the decimal points. They take the binary form for storage. ‘The size of the integer depended on the word length of a machine le,, It can De {ither 16 or 32 Dts, On 8 lé-bit machine. The cange of integer value fs -32768 to 32767. °C’ provides control over the range of Integer value and the storage space occupied by these values trough the data type "shor int, “int, Tong int In both “signed” and “unsigned form. Signed integer: Signed integers are those integers which uses 45 bits for storing the magnitude of @ number and 1 Bit to store its sign. The lefemost bite, 16th bit lused the sign fis 1 for negative number and 0 forthe positive number. Unsigned integer: Unsigned integer use all 16 bit Le,, (154+z) bits to store the magnitude i., these are the whole numbers that always hold postive values and the sign bi also contains the velue bb, Character Data Type: The data type indicates that value stored in the associated Variable fs a character, Each character has an equivalent ASCII value. These characters are internally stored as integers, “enar’ data type occupies one byte of memory for the storage of character. The ‘qualifies signed and unsigned can be applied on “char data type. www Rabyanit.com Phi 040-6662 2789, 6662 3789eee + ‘Kabyan IT Training (Hyd) Pvt Led Character Data Type | Type ‘Size Range Format specifier ‘har (67) signed char T “126 t ¥i27 We unsigned Ghar T Oto 255 | 2, Floating-point Data type: Floating point data type is used to store real Tiumbers. The keyword "ioat’ is used to declare @ variable holding a floating-point numbers with 6 dit of precision occupies 4 byte for storage. For greater precision wwe can use the ‘double’ data type for further precision, we have long double, DATA Type Qualifiers: A quae isan adjective desenbing the data type. They are used in combination with the basic data types. This quelifer along with deta types. These {uelifiess along with data types can be used to habe contol over storage space and range of numbers °C’ language provides a set of qualifiers as glven below, short i. ong | © signed 6. unsigned ‘short: This qualifier can be used only withthe data type int Syntax: short int variable; ‘shor int’ is used for small ronger values (-128 to +127) and it occupies 50% of storage space (1 byte) as compored to regular int (2 bytes) Yong: this qualifiers is used along with the data types “int and ‘double’. This qualifier 's used to increase the range of values, thus consuming more storage space Syntax: iong data-type variable; + The qualifier ‘long’ when associated with ‘int! data type takes a range of integer values and occupies 32 bits (4 byte) for storage + The qualifer “long” when associated with ‘double’ data type takes @ range of floating point values and occupies 80 bits (10 byte) for storage. Signed: The qualifier can be used with ‘int’ and ‘char’ data types. This qualifier leffects the intemal representation ofthe cata value, When signed qualifier is used with the basic datatype the stating bit of storage gets reserved forthe sigh Unsigned: This qualifier can be applied with int’ and ‘char’ data type, This qualifier When used, the total bits get reserved for the magnitude, thus the range of valves 9¢ts increased. www fabyanit com Ph: 040-6662 2788, 6662 3789Kalyan IT Training (Pyd) Put Led Constants: A quantity or number that does not vary during the execution of program Is known a5 constants. These constants are classified into two types, 1. numeric constants 2) Character constants 11, Numeric constants: Numeric constants can be classed as, ‘Integer constants ®. real constants ‘a. Integer constants: The integer constants are confined tothe following features ‘9 Iteontains minimum of one digit 9. Ttdoes not contain a decimal point 5 Blank spaces and commas are not allowed within the integer constant An integer constant can be elther pasve or negative value. + &«: 400, +789, -100, et “Tne range of integer constants depending on the machine. ‘C’ provides a range of 32768 to 32767 integer constants for 16 bit word length machine and -1247483648 to 2147483647 for 32 BI A long integer, unsigned integer and unsigned long Integer constant can be represented by appending the | oF Lv Or U or UL respecively x: long integer constants: 984915601, 984515601 Unsigned integer constants: SSS96U, SS596u Unsigned long integer constants: 9557133451, 955713345. ‘kn integer constant can be represented in any one of the three numbers system le Gecimal, otal, hexadecimal Decimal integers: These constant consists of numbers from 0 to 9 preceded by ‘option sign. Ex: +129, 95,145, ‘An octal integer: These constant consists of any digits from 0 to 7 with leading zero (0 Bx: 037, 067,050 Hexadecimal: These integer constants consist of combination of digits from 0 to 9 dnd alphabets, |e, e-f oF AF. The alphabets a to f represent numbers 10 to 15 Tespactvely, Hexadecimal numbers are preceded by Ox or OX Bie OFAS, OKAS, Oxa6e b, Real constants: Real constants are the quantities which contains fractional part Lie. decimal point, Real Constants are also known as floating-point constant. Real constants Can be represented in two ways. 1. "Decimal (fractional) form ware Kabyanitcom Pi: 040-6662 2789, 6662 5789eee SSS EE : Kalyan IT Training (Hyd) Pot Led 1, Exponential (scientific) form Decimal form: The real constants represented in decimal form are confined to the following res. +The constant must contain 2 whole number followed by decimal point and fraction part + Bean be ether +ve or -ve {blank spaces and commas are nat with inthe real constant 1 The digits Before and after the decimal paint can be omitted Ex: 110.1, +305.25,-400,50,-0. | Exponential form: Exponential frm Is used to represented the real constants both father too large oF too small value, ‘ x1 8500000000 can be represented as 8.569. (0.000000786 can be represented as 7.86e-7. “The real constant represented in exponential form consist of two part, mantissa (ie, part appearing before the later © ore) and exponent (i.e. part appearing after € or ‘@) Areal constant represented in exponential form Is confined tothe fllowing rule 2 'SIne letter e or e must separate the mantissa and exponential par. {mantissa pare could be ether a real number or an integer .mantissa part could be ther 4ve or ve (default is +ve) + Exponential pare must be contain at least one digit, which could be either a +ve or ve integer + The real constant can be represented as float (Le. single ~precision) and tong double (ue. extend double ~precision) by appending the terminals "or and‘ ‘or respectively (note: default is double-precision), Character Constant he character constants can be divided Intg two types, ‘2. single character constants B. sting constants Character constants: A single character constant Is @ single digits, alphabet or special symbol, enclosed within single quotes, Bea, t+ {character constant represents numeric value. (J.., ASCH value ofthe character). A Character constant is therefore arithmetic operations Maximum of one character is taken within 2 characteris taken within a character constants. ‘String constants: A string constant contains group of character (ier alphabets, cits, special symbols and blank spaces) Be: “welcome”, "=" "1082" 10 sow Rabyanitcom (Ph: 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Pot Led 18, Type conversion: Sometimes programmer needs the result In certain data type. Example, division of S with 2 should return float value. Practically compiler alvays Fetus Integer values because both the arguments are of integer data type. In those ‘ases type conversion i required. Exc print? Cn two integers (582) = 96d", 5/2);-> 2 printf *\n one integer and one float (5.582) : 6, 5.5/2); > 2.75 Drint (*\n two integers (582) : % (float) 5/2); 5 2.5 9. Operators: Operators are °C tokens which can joined together individual constants, variables array elements and function references, Operators act upon data ems ‘led as operands. Classification: Arithmetic operators Relational operators Logical operators Assignment operator Increment and decrement operator Conditional operator Bitwise operator Special operator 1, Arithmetic Operators arithmetic Meaning operator + ‘Adding or unary plus 2 Subtraction or unary Mutiptiation 1 Division % Madiulo vision ‘+ For arithmetic operations, operands must be numeric values. ‘+ Here modulo division produces reminder of integer division. ‘+ Arithmetic operations are clasified as, integer arithmetic + real arithmetic 1 mixed mode antmetic u ww. Kabyanitcom (Phi 040-6662 2789, 6662 3789ee EE—E>E—E——EeFFE«_«-_-.,_,,,_e Kabyan IT Training (Hyd) Poe Led Integer arithmetic: Goth the operands are Integer ln integer arithmetic. It always Yields an integer value x Int a=10, 4b, a-b, a¥b, a, amb ete Real arithmetic: Both the operands are real in real arithmetic. It yields real values {2s result. Ie cannot be applied to 8» operator. fe: float a=10.0, 5.0 1. 15.000000 ‘Qie. 5.000000 10.0*5.0 =50.0 je. 50.000000 afb= 10.0/5.0 = 2.0 j.e. 2,000000 2%b=10.0%5.0 (invalid expression) Mixed Mode Arithmetic: When one operand is Integer and ether is real itis known {as mixed mode arithmetic. Here the result wil always be rea. ent float b=5.0; a¥b=1045.0=15.0 2. Relational Operators: These are used to compare two quantities, ‘+ These operator always returns I(true) oF 0 (false. the expression is true than it retums 1 else 0 Relational Operator ‘ation = isles than is less than or equal to > is greater than is greater than or equal to Is equal to ( ' Is not equal to ww: Rebyanit.com Ph: 040-6662 2789, 6662 3789Kabyan IT Training (Hyd) Pot Ld pression Resule 10 0 (alsey 1095 1 (true) 0 (fase) 1 (eve) 1 (eve) 3. Logical Operators a Operator | Tegra logical on logical NOT + Logical exaression combines two or mare relational expressions. Logical operators are used to test more then one condition and make decision Logical AND: The result of logical AND expression will be true only when both the relational expression are true.Syntax:exp1 8 exp2; Logical OR: The result of logical OR expression will be felse only when both Felational expressions are false-Syntax:expt || x02; Logical NOT: The result of the expression wil be true Ifthe expression is false ‘and vice versa. Syntax: lex; b=15, €=20)) ‘a>b) 8 (Dec); ‘The value of | in tis expression will be 0 ‘a
b) Il (Dc): ‘The value of inthis expression will be 1 Va>0}; “The value of In this expression wil Be 1 2 www Kabjanit.com (Ph: 040-6662 2789, 6662 3789a——eeeeeeE Kabyan IT Training (Hyd) Pvt Led 4. Assignment Operators ‘The operators are used to assign result of an expression toa variable Syntax: variable = exp: Assignment Operator ion Tatabi ant0;be5; +1) or at=35 ‘adds 1 to a and assigns the value to 8 \ aeerl; ort; ecrements a by 1 and assigns the value to 8 aeal(b¢1) oF a/=b+1; divides a by (b#1) and assigns result toa | ‘multpies (642) with a and assigns result to a Increment and Decrement operators ‘These operators are represented as "++" and °~’. ++ Increments operand by 1 land ~- decrement the value by 1. These are the unary operators and takes the following forms. ‘Operator ‘ation Result tab pre increment | Increments a value by 1 and assigns the value to. Le., a=2 and b=2 Assigns the value tob then increments a value post-inerement | by 1, he,, a=2 and bea decrements a value by 1 and assigns the value | pre- decrement tob. ie., a=1 and bet vst decrement | Asons the value to b then decrements 2 value ite Y by 1. Le, a=1 and b=2 “ www fafyanit.com Ph: 040-6662 2788, 6662 5769Kalyan IT Training (Hyd) Pot Led 6. Conditional Operator:_It is also known as ternary operator ‘Syntax: expt ? exp2 : exp3i, ‘Wihere expt, exp2 and exp3 are expressions “The value of y is 15, yaad) 2b: The value of y Is 10 Greatest of three numbers using conditional operation. Yy=(a>b && ac) 723 (0>6) 7b: ¢ Here greatest of three numbers is stored in x; 7. Bitwise Operators Bitwise operators are similar to that of logical operators except that they work fon binary bits, When bitwise operators are used with variables, they are | Intemally converted to binary rumbers and then bitwise operators are applied on Individual bis. Bitwise operators do manipulation on bit stored in memory. These operators | ‘work with char and int type only. They cannot use with eating point numbers. Bitwise Operators ‘Ration = Ts compliment ' bitwise OR Bitwise exclusive OR 8 Bitwise AND, << Let shirt oS Right shit | inta-io,p=8; ‘The equivalent binary value of as 0000 1010 | The equivalent binary valve o ls 0000 1000 1 the value of a 2 the value of | 0 3. the value of * b= 0000 0010 Le, 2 4. acca Itlet shift the binary Bs twice. Le 0010 1000 5. asd: It aght site the binary bts twee, 0010 | 8. Special Operator “Tere are some. special operators avalible In 'C' such as sizeof operstor and J tramber selection opersters (ane =) 1200 1000 i.e. 8 wwe febanitcom i 010.6662 2788, 66625789a ———————EEeESGq0C_0—uVrerer,r,rté*séstéaeeeeeeeee""=st—i‘itsS Kalyan IT Training (Hd) Pot Led sizeof Operator: It returns numbers of bytes the operand occupies; operand may be a variable, a constant, ora data type qualifier. ‘Syntax: sizeaf(operand); Be intys Y= sizeot (int); here value of y wil be 2 byte Memiber Operators: These are used to access members of structure and unions, ‘Operation “clubbing eority Function cal Square bracket Left to Right Structure operator Structure operator Unary plus Unary minus Increment Decrement Not operator Right to Lo (Ones complement Pointer operator [Adaress operator Size of an objet ‘ype case Multipteation Division Lett to Right Moduler éluision Adcition Left to Right Suberacton er shi Lett to Right Right sit Less than Less than or equal to Greater than Left to Right Greater than oF equal to Equality Left to right Tnequality Bitwise AND Lett to ight Bitwise XOR Left to nght Bitwise OR Left ta ant Logleal AND Left to right ogteal OR Late to right Conditional eperator Right to left Assignment Aight to lett operatars sew fabanitcom (Ph: 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Pot Lad 10.Expressions: [An expression in Cis constructed using operators, variables and/or constants. Be ayes xey Key BS 11,3/0's: Reading the data from the input devices and displaying the results on the screen are the two main tasks of any program. When a program needs data, it takes the date through the Input functions and sends results obtained through the output functions, Thus, the input/output funetons are the link between the user and the terminal The 1/0 functions are classified into two types: 2." Formatted functions 5, Unformatted functions ‘2. Eormatted functions: The formatted 1/0 functions read and write all types of Gata values. They require conversion symbol to Identify the data type. Hence, they can be used for both reading and writing of all data values. The formatted functions return the values after execution. The return value is equal to number of variables successfully red/written. Using this value the user ean find out the terrors occurring during reading or writing the data. Ex: print(); , scant); ‘The unformatted 1/0 only works with the character Gata type. They do.not fequlre conversion symbol fr identification of datatypes because they work only with character data type. There Is no need to convert the ) ata. In case valves of other data types are passed to these functions, they are treated as the character data. The unformatted functions also return values, But the return vaive of unformatted function is always same. Tunes: (2). Character 1/0. TEx: getchar(), putchar(), geteh() & getche(), putch). (b) String 1/0, Ex: gets(),puts(), cgets(), puts). } (0. File 1/0. j 12, Statements: & statement is an instruction that causes an action to be performed when execited, The C statements ends with °s', In C there are 6 types. of ‘atements 2. Selection statement: Selection statements are statements that are executed ‘depending on the canltion, These indide I and switeh. b, Iteration statement: These are executed repeatedly until @ condition Is satished, These include for, while, do-while. & Jump statements: Jump statements alter the flow of execution. These are ‘break, continue, goto and return 4. Label statements: Label statement Is used to give the location of the target ‘Statement to which control must transfer. Ex: case, default and label. e. Expression statement: The statements composed of valid expression ore expression statements 4. Block statement: A block consists of a st of statements enclosed within lower braces. These are also called compound statements. 13, Decision control instructions in C: We have seen that a C program Is a set of statements which are normaly executed sequentially in order in which they appear. By default, the instructions in a program are executed sequentially In serious ” ww Rabyanit.com Ph 040-6662 2789, 6662 3789lm» _—_ _ _ °°» Kalyan IT Training (Hyd) Pot Ltd programming situations, we want a set of instructions to be executed in one Shuetion, and diferent set of Instructions to be executed In another situation. This tind of station is deste with In C programs using a decision control instruction. & Seciston control instruction can be implemented in C using: If statement. ‘conltional operator statement ‘Sitch statement ‘to staternent. [A if statement: The if statement is @ powerful decision-making statement and is used to control the flow of execution of statement. The Keyword if els the compiler that ‘what follows is @ decision control instruction. The condition folowing the Keyword If i always enclosed within a pair of parentheses. I the condition, whatever itis true, then the statement is executed, Ifthe conctton is not tue, then the statement isnot txecuted, As a general rule, we express @ condition using C's ‘relational and logical i Sperators. The JF statement may be implemented in different forms depending on fhe complefty of conditions tobe tested, The diferent forms are: * 1. simple if statement, 2, else statement. 3, nested if-else statement. 4. elsif ladder simple if statement : "conan ) 4 statement-block; Statement-x, The above figure describes the general form of a simple if statement, The “Ratement-block’ may be a single statement of @ group of statements. if the (Dndtion 1s true, the statement-block willbe executed; otherwise the statement= Block wil be skipped and the execution will jump to the statement-x. Remember, . tien the condition is true both the statement-lock and statement-x are executed in Sequence. ‘Note: In simple if statement, only one statement is there no need to open body iftelse statement : ‘The if statement by itself will execute a single statement, or 2 g°0uP of statements, when the if condition true, when the concition is false, can we execute Shotnes group of statements! This is the purpose of else statement, The if else Statement on extension of the simple i statement. The general form Is 38 swune.fayanit com Ph: 040-6662 2789, 6662 3789Kalyan IT Training (yd) Pot Led ‘# (condition ) « true-block... statement (5); D) else (conaltion ) « fhase-block...statement (5); If the condition is true, the true-biock statement(s), Immediately following the If statements are executed, otherwise the false-biock statement(s) are executed nested itelse statement : When a series of decisions are involved, we may have to use mare than one itelse statement in nested form. If the condition-1 is flse, the statement-3 will be ‘executed, otherwise It continues to perform the second condition Ifthe coneltion-2 ie true, the statement-1 will be evaluated, otherwise the statement-2 wil be ‘evaluated and then the control jumps to statement-4 Note: Else's always matching with the most recent unpaired If 1 Ccondttion-1 1 condliion-2 ) « statement; alse < statement2; > > « > statements; statement3; 19 sw. Kabjanit.com Phe 040-6662 2789, 6662 3789aE ees bifferent Forms of if- else : if Cconeition) statement If Cconeition) statementt; else statement2; Te conatton) staternenti; if condition) statementt; « statements; Kalyan IT Training 6d) Pot Led WC coneition ) « statementt; IF Cconeition) < ae | statement; Teonaluon ) « If (condition) statement; staternents; statement; www Kabyanit com Phi 040-6662 2789, 6662 3759Kalyan IT Training (Hyd) Pot Ltd B. Conditional operator: The conditional operators ? and : ere sometime called temacy operators since they take three arguments. Their general form Is, ‘expression 1 ? expression 2: expression 3; nat this expression says is: “if expression 1 Is tru (that I, if its value is nonzero), then the value returned will be expression 2, otherwise the value retumed will be expression 3° Note: 1. Number of question marks and colon should be equal 2, Every colon should match with just before question marks. G. switch statement: The contro! statement that allows us to make 2 decision from the numberof choice is called a switch “The switch expression must be an integer type. Cage labels must be constants or constants expression, (Goselabels must be uniaue. E (Case labels must be end with semicolon. ‘The break statement transfers the control out of the switch staternent. ‘The break statement Is optional. Thetis, tivo o¢ more case labels may belong to the same statement. + The default label is optional. IF present, t will be executed when the expression does not find a matching case label 1+ There can be at most one defauit label +The default may be placed anywhere but usually placed at the end. + Itis permitted to next switen statement. 1. Using case and default must be within switch body, Using break is optional you can use in switch or loop body. ‘The integer expression following the keyword switch Is any C expression that will yield an integer value or characters. It could be an integer constant oF an ‘expression that evaluates to an integer. The keyword case Is followed by an integer ‘or a character constant. Each of these values should be unique. Block-1, block-2 are statement lists and may contain zero of more statements, There 's no need t0 put braces around these blocks. Note that case labels must end with a colon (:), What happens wien we executed program containing a switch? Fist, the Integer expression following the Keyword switeh is evaluated, and compared against the values constant, constan2,.. If 2 matching ease is found then the block of statements that follows the case are executed up to break(optional if iis there) or all statements from matching ease including default, and transferring the control to the statement falloning the switeh. a www Rabyanitcom Ph: 040-6662 2789, 6662 3789ne Kalyan IT Training (Hd) Pot Lid site (integer expression ) « case constant block; break case constant2 block-2: break . defaut: statement; break > statement-x; ‘The default is an optional case, It willbe executed ifthe value ofthe integer expression does not match with any of the case values. IF nat present, no action fakes place fll matches falls and the control goes tothe staterent-x. ‘goto statement: The goto statement to branch unconeltionlly from one point to [nother point inthe program. ‘The goto requires a label In order to identify the place where the branch is fo bbe made. A label is any valid variable name, ané must be folloned by a colon. The label is placed Immediately before the statement where the contr is to be transferred. The general form of goto and label statements is shown below: Note that a goto breaks the normal sequential execution of the program. If the lable: is before the statement oto label; @ loop will be formed. and. some Statements wil be executed repeatedly. Such a Jump is known es @ backward jump, Gn the other hand, if he label: is placed after the goto label; some stetements will be skipped and jump is known as a forward jump. www Rayanit.com Ph: 040-6662 2789, 6662 3789Kabjan IT Training (Hyd) Pve Lt goto label; lab: statement; labet statement; 15, Decision making and looping : ‘In the all programs written so far, execution begins at the start of main ) {function and proceeds line by line until end of the Program. But if you want Zo print something repeatedly, say printing something on screen fve times, you can incuce S-pint statements. Buti you want to print 100 times it cannot be done lke is, TO ‘do repetitive tasks, we use loops. In C there are three types of loops. Such as. ‘2. while 10. . do-wnile top. ©. for oop. Looping Process includes four steps. They are As follows, 1. ‘Setting And inillzing variables (counter) 2. Evaluate the test EXPRESSION 3. Execute The body OF loop If test expression Is TRUE 44 Increment or decrement the counter variable, white loop : ‘The wile statement will be executed repeatedly as long as the extression remains true. Its syntax Is as follows, ‘The body of the loop wil be executed repeatedly as long as the candition romaing true, When the wile Iz reached, the computer Cvaluates conditions If ts feund to be false, body of loop wil not be executed, ond the loop ends. Otrerwise, the body of loop wil be executed, and then condition is checked again and se on, tl condition becomes fase. ‘while (condition ) « statement; body of lop: env Robyn com Ph 040.6662 2789, 66623789 ai Kabyan IT Training (Hyd) Pvt Led Examplet: /* Caleulating sum of fist 5 Natural numbers */ void main() ‘ int sum=0; sum=0; et; nization */ wiile( '<=5) P* condition */ 4 ies /* inccementing *? > printf('sum=96" sum); ‘The code given above finds sum of frst 5 Natural numbers. The execution of this Inhile statement i don 28 follows, + Variables | and sum are initaized «+ Corti (<5) is evalusted. The result is true .e, hence body of ‘while Toop is executed. + Sums evalusted and | Is incremented by 1 Again expression (i<=5) is evaluated. The result is true so body of loop is Qkccutes agains This process = continued unt the condition becomes false. do-while loop : ¢ Teel to while loop except of wile loop except that it always executes ‘at least ance, The test of expression for repeating Is done alter each time body of inop is exccuted. Syntax Tor do-while Is as follows, 2 www, Rabyanitcom (Ph: 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Pvt Ltd” statement body of loop; ‘hile condition );, ‘The below example = used to find sum numbers from 1 to given input rumbers this do-while oop Is executed as given below, + Variables sum and are intalized, and n value wil enter at runtime (n«5), {Body of foop is executed and sum, | values are computed, 1 Expressiona(ic=n) is evaluated, It is true s0 the body of loop is executed gain +The loop Is executed repeatedly until the condition *i<: false (it happens when '=6). (n=5) becomes Example2:/* Calculating sum of the values from 1 to given input number"/ void main() i Ine n.sum; Drintf(ENTER A NUMBER"); scant ("6d"); 1 initialization */ ii; J? incrementing */ > while iceny "condition */ primum 96d" sum} > utp ENTER A NUMBER 5 sum=15 2s wow Rabyoit.com Ph; 040.6662 2789, 6662 3789er eae eee eee Kalyan IT Training (Hyd) Pot Led for loop : For statement js another type of looping statement. the difference between for and while, do-while starement fs that, In while staterments that number of passes fre not know In advance whereas in for” statement the number of passes are knov In advance, The general syitax to fer loop Is. iteration ) ‘This Toop contanse three parts; these are Iniaization, coneltion and ‘teration itis possible to amit al the three expressions in the for statement but its. necessary to have two semicolon, If assignment expression and unary expression are Omitted, then other way smould be present to iitiaize and modify the inital value. If the conditional expression ts omitted then itis assumed tha, it have a static value 1 lath it tue. This static value makes the looping structure to be executed infinitely Until terminated by using aeak or return statement 4+ When for loop is executed forthe ist time the value vil intialize 1 Than it checks the condition f tne condition is true and the bady ofthe 120p Is executed for first tme. + Upon reaching the closing brace of for, control is sent back to Iteration part of the loop, 1+ -Agein fe checks the condition, than eoneition is true and the Body ofthe loop is executed othernise loop 's terminated and execution continue withthe next Statement thet immediatly following the lo: 17 Calculating sum of the values from 1 to given input number*/ ‘void main() i int ,n,sum=0; print(ENTER A NUMBER"); seanf("%d"8n); forCi=t jic=n i++) print("\ynsum =a sum); ? output: ENTER A NUMBER 5 sumei5 “The above loop where i=1 is an expression that specifies the Initial value and that controls the looping acton.26 \<=5 is a condition, that is tested at each poss sew Kaan com Pi 010.6662 2788, 6523789Kalyan IT Training (Hyd) Pet Lad ‘The program is executed til this conition remains true. ++ Is an unary expression, that is ether increment or decrement tO change the Initial value. The consitlonal expression is evaluated and tested at the beginning while unary expression Is evaluated at the end of each pass. nesting the loops : Nesting of loop, that is, one lop statement placing into another loop. vile (condition } « white loop bodys {or initialization; condition ; iteration ) « for loop boty; break and continue: freak and continue are unconeltlonal statement which are used within @ program to alter the flow of control breaks: “break’ is 2 keyword used to terminate the loop oF exit fram switch starement, Its written 25, statements; break 1 ean be used with for, while, do-atile and switch statement: 2 www kabyanit.com (Phi 040-6662 2789, 6662 3789PRR eee eee eee Kabyan IT Training (Hyd) Put Led bet char cholee; ‘str(enoice) < case Vs printf"yes"); break; ease W's printfCno") break; + ere break statement is ussd in order to transfer control out of switch statement, ee? Inti iy wile <5) continue: ‘continue'is a keyword used to skip same specific statement in loop body. It must be used with while, for and do-nfile ‘whet ie= 100 ) « ie=2; C1549 ani
Ex: float sum (float x, floaty) float 2; . CALL BY VALUE AND REFERENCE: There are two ways it which we can pss Sraumentsto the fcton I. cal hy valve 2 Ca by eterence all by Value: In ths type vale of acta ergments ere passed to the formal srauents andthe operation dane ante foal agus, Any change nace Inthe formal orgument soes not sfc the actual argues eens fr arguments are potooay of actual ergents, Hence, when uncon called by the calor by value method, It does at aft the aus eontents ofthe actual arguments, Changes made Inthe formal arguments ela to the Doo of te fated Tuncwon. Once contol returs back tothe caingunction the changes made vers 2. Call by Reference: In this type instead of passing values, addresses (reference) ‘are passed. Function operates on addresses rather than vaues. Here the formal 2 ww koGanitcom i 0106662 2789, 6662 37891 oe a wal che 5 ce) mal Kabyan IT Training (Hyd) Pvt Led ‘arguments are pointers to the actual arguments, In this type formal arguments point to the actual argument, Hence changes made in the arguments are permanent, Using call by reference method function can return more than one value per cal. > ult suitable exemples, 10°Return’ or return(expression) : 1+ The first type return does not return any values, it acts much as the cosing brace of the function, When a return is encountered, the control is immediately passed back tothe calling function. When 2 value is returned, it automatically convert the functions type. oat sumtin vist v2) lesum(5,5); Fosum(5,5); Print" 96d FN; “Error: required argument missing. 3 wu faba. com Ph 040-6562 2789, 6662 3789Kalyan IT Training (yd) Pot Lad 15 Note: “+ When the function returns integer It i not required to declare It even if it defined later. int sum(int int)? Tr=sum(i2 3); [oat sum(foatflost); SSS FS sum(2, (3); [char sum(charjint float); | eX=sum(e2, ii fi); ‘void sum( jj oF void sum(vold); | sum(); ‘void sum(intchar)y———SCS~* su, oat sum(char int float float); f= sum(e4, 112,13); LL.Types of functions: There are two types of functions in“ language. Programming 8. Library funetions: The library functions are pre-defined set of functions. Their {ask is limited. & user can not understand the intemal working of these functions ‘The user can only use the functions but cant change ar modify them, bi. User defined functions: these functions aliow the programmer to define thelr ‘own functions according to the requirement of the program. The user has full scope to implement his/her own ideas in the function. The user certainly Understands the internal working af the function. ‘Types of User Define funetion: A function, depending on whether arguments are present or not and whether a value s returned or not classified into four tyoes, |. Function with no arguments and no return type. Ti, Function with arguments and no return type ii, Function with no arguments and one return value iv. Function with arguments and return type a6 wovw Rabyanit.com Ph: 040.6662 2789, 6662 3789Kalyan IT Training (96d) Pot Led ‘+ Ifthe function retun type Is other than void then returning a value tothe calling plaze is optional ‘+ Even thought function ls returing the value collecting the value also optional Default return type to any function is int. |. Funetion with no arguments and no return type: When a function has no arguments It does not receive any data from the caling function. Similar, when It does not return a value, the calling function does not receive any data from the calle function. There is no data transfer between the calling function and called function. The function is only executed and nothing is obtained. Such functions may be useful to print some messages, draw a line or spilt the line et, jing function Analysis | Called funetion main() vold abet ) € No arguments are | : passed. - Drintf"\nello xy 2be(); ‘Np values are sent | ‘ola mainc ) back € abe) Drinti(\nhelio mata); |i, Function with arguments and no return type: Function receiving data from the calling function, But does not return a value; the calling function receives cata from the called function. And called function is does not retutning any values. There is one direction data transfer between the caling function and called function. ailing ‘Analysis Called Beample function i“ function ‘main() abe(v) Void maint) « Arguments are | { t == | passes void sumtit int; - ‘5ur(10,20); abet); No values are > sentback |) ois sume int a, int b) « > printf("sum of. 2,b=9d",2+); y = Outout: sum of ab=30 | 1, Function with no arguments and return value: Called function does not tecave any dats from the clog funtion, but wil return the vale Bok, tothe Cotng place Thre Te uldrecng dato taste rom ale! fac to elng foncton 3 nw fabanitcom hi: 040-6662 2789, 65523789Kabyan IT Training (Hyd) Pvt Led Calling funetion [Analy Called function | Example main() abcd) int get number) e No arguments are | C passed. Int intr : seanf(“%d",8n); values are sent oe return; back. return (y); 3 old main() Intl: t_number() rinti("¥6a")); 2 1. Function with arguments and return type! Called function racive data From the calling function and return the value back to the calling place. There is biirectionl data transfer between the calling function and called furction. [Calling funetion | Analysis Called function [Example a ‘main() ‘abe (9) ik st way « ine Argument(s) are -- return vitv2: essed. vet: > ue 7 ‘oid main( ) z= abet; |Vatuesare sent | returntyy; | € = back, > inti a ‘=sum(19,20); ? antic s6d"); Note: Perameters are used in three places, In declaration, function call and function etinition ‘The argument (parameter) used in prototypes (decaratien) and function definitions are called formal arguments and those used in Rincon calls are ‘ales actual arguments. Actual argument may be simple corstants, variables or expressions. ‘The formal and actual parameters must match exactly In type, order and number. [Any function is returning the value to the calling place itis dane through the return statement, ‘The retum statement can use in two ways: 36 sw ajanit.com {040.6662 2788, 6662 37592 Kabjan IT Training (Hyd) Prt Led When a called function in tum calls another function a process of ‘chaining’ occurs. In C, its possible forthe functions to cal themselves. A function Is called recursive’ f a statement within the body of a function calls the same funtion, Recursion isthe process of defining something in terms of itset 7* Non-recursive function for calculating the factorial values of an integer */ Int fac (int n) returns > vo main( ) ‘ int fact rintf"\nenter any number"; seant("s6d", 8a); > output: enter any number 3 factorial value=6 413.Scope variables: Scope of a variable Is defined as a vicinity oF space within a pragram, where value of a given variable can be accessed ” www fabponitcom (Ph: 040-6662 2788, 6652 3789; Kalyan IT Training (Hyd) Pot Led ‘The area or block of the ‘C’ program from where the variable can be accessed Is known as scope of the variable. The area or scope of the variable depends on its storage cass Le. where and how itis declared. There are four scope variables: ‘2. Function . File © Block 4. Function prototype Block structure: Block generally refers to a segment within @ program providing certain functionality to that program, The ways these Blocks are organized are referred as block structures. [A block may hold variables, structures, expressions, contro! structures tc,, wich are necessary for a program. It initiates with an opening brace and terminates with @ closing brace. A program can hold any number of blocks, also itis possible to insert a biock within another block 14 Storage classes: The storage class of a variable tells the compiler a. The storage area ofthe variable. The intial valve of variable f not inialized The scope ofthe variable, @. Life of the variable i.e. how long the variable would be active in the program. ‘Types of storage classes: There are four types of storage class in 2. Automatic . extemal Static 6. Register Notes Automatic static, and external storage classes are kept memory type. a. Automatic storage class: Automatic variables are declared inside a function in which they are to be ulllzed. They are created when the function is called and estroyed automaticaly when the function Is exited. Hence, the “automatic” variables are private (Joca) to the function in which they are declared, 38 wren Kabyanitcom Ph: 010-6662 2789, 6662 3789ie, . ee a Kabyan IT Training (Hyd) Pvt Let A variable declarad inside a function without storage cas specification is by default an automatic variable, ‘Wee may also use the keyword auto to declare automatic variable. External storage clas: program are known ae external variables, They ae elso known a global variables, can be accessed by any function In the program. External varables are declared outside ofthe function. ‘Auto variables are kept memory type. Default value for this variable is an unpredictable va Le. called as garbage value, ‘Scope of the auto veriable within the block, which the variable is defined. Life ofthe auto variable til the control remains withn the bloc, In which the variable ls defined, 3: Variables that are both alive end active throughout the Once @ variable has been declared as global, any function can use it and ‘change its value. Then, subsequent functions can reference only that new value. ‘One other aspect ofa global variable Is that i is available only from the point of decaration to the end ofthe program. defined. So, the compiler wil issue an errar message, 38 www Rabyanitcom Phi: 040-6662 2789, 6662 3789: Kalyan IT Training (Hyd) Pot Lad void fun; vold main () « ‘extern int yi IF you want to access 2 global variable into the our main) function by using the keyword extern; ie. external declaration. Note: + Exter variables are kept memory type. 4+ Default value for this variable is zero, ‘+ Scope of the exter variable is global, i.e. forall functions. 1+ Life of the exter variable i, a5 long the programs execution doesn’t come to an end { «. Static storage class: As the name suggests, the value of static variables persists Until the end of the program. A variable can be declared state using the Keyword state A static variable may be elther an Internal type or external type c epencing on the place of dedaration. Internal static variables are those, Which are declare inside a function, the scope of intemal static variabe, ; extend up to the end of the function in which they are defined. Therefore, Internal static variables are similar to auto variables, except that they remain 4 In existence throuchout the praoram. Aan extemal static variable is declared outside of all functions and is, available to all the functions In the program. The difference between a static “0 swww.Rabjanitcom Phi: 040-6662 2789, 6662 3789Kalyan IT Training (Pyd) Pot Led external veriable and extemal variable ig that the static extemal variable is available only within the fle where iti defined while the external variable can bbe accessed by ather file A static variable is intaized only once, when the program & compiled. I Is never intiaizes again, ‘+ Static variables are kept type. + Default value for this variable is zero ‘+ Loca tothe block In which the variable is defined, 1+ fe ofthe stati variable is, as long the program's executon doesn't come to an end. a wu Rafyanit.com Ph: 040-6662 2789, 6662 3789‘Kaban IT Training (Hyd) Pvt Ltd ¢. Register storage class: It is created at the neares: memory available to the ‘CPU named as register. A value stored In @ CPU register can always be accessed {aster than the one that is stored in memory. Limitations: = We cant create "n” no. of register variables (maximum 10 or 20) epenaing on CPU. ‘+ We cant collect the address of register variable. Note: + Defauit value for this variable is garbage. "+ Scope of the register variable is within the block, in which the variable {s defined + Life of the register variable til the control remains within the block, In hich the variable Is defined 114.Library Funetions: °c’ has @ large set of useful built-in library functions which are ready to be used in our programs. The function prototypes for these functions are avaliable in general header les. Therefore the appropriate header ie for a standard function must be included at the beginning of eur programs. 1a. Mathematical Functions: These functions are avaltle in “math. Function | Description rotetyping Example abs Returns the absolute [int abs (int nam) abs(-5)=5 value of an integer number. fabs | Returns the absolute | double fabs(double 1um);_ | fabs (2.2) = 3.2 ‘value of floating | point number Jabs | Returns the absolute | long labs(long num); | abs( 3.21 value of@ Tong integer umber call Returns smallest | double cell (double sum); | call (3.005)=4 Integer value greater than or equal toa umber double foor(doube nur): floor | Returns the largest oor (3.9993)=3.0 Integer value fess than lor equal toa number pow | Returns the value of # | doubie pow(double 3, | pow (2.0, .0)=32, a ww Rabyanitcom Pi: 040.6662 278, 6662 3789Kalyan IT Training (Hyd) Pvt Led ‘aed tothe power. | double By; Sneroroceurs Fa =0 Snopes dor aco Sand bis noc an integer sort Retums the square | double sqr{double rum); | sqr(144.0) = 12 ‘oat of a number. bi. String Handling Functions: These functions are avalable in "string, Function Description Prototyping ‘stepy streny (target, | Coples source source) string to target | string and returns target. streat streat (target, | Concatenates treat st,82); source) source string to fend ofthe target ‘and returns target sen steten (source) | Returns the length of the source string. sromp stremp (srt, str2) | compares two | r= stemp (51,82); strings and returns Values are: O- 2 <0 ifstrt < str2 30-itsti>str2 & General Library Functions: These functions are available in "stli.h". [Description | Prototvpina __| Example srend creates the fist | vold srand srand (920); seed fore (unsigned int pseudorandom | seed) fumber seres, Seed is 2 varicble that ie used by the random umber generator to generate next hhumber series a wa fayanit.com Ph: 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Pot Lid and; rand Returns a Int rand (void); pseudorandom Integer in the range 0 to RAND_MAX. in ANSI/ISO standard the RAND_MAX value 1s 32,767 1S.Header files & Preprocessors: The header fle section and global decaration secon are valued for providing unique funetions to carryout program execution ‘smoothly In standard °C’ program format. Header files: Every ‘C’ program consists of certain provision of header files, provided at the top of main() function. They generally begin with symbol "4" faliowes by @ predefined word "include". With the inclusion of header file prior to ‘main function facilitates us to use or declare various functions, prototype, ete Wihich are nothing but the constituent entities of decared header files. Example, stdlo.h header file faciitates us to carryout various ia funetions in out °C’ program. Funetons ike printf), sanf() possess a predefined code in the stlo library. Note: 1. every header file possess extension, 2. Ibis possible to create our own header files 3. In some compilers few header flies are pre included. We need not require to write include before main), Preprocessors: In general terms the word prepracessor is @ code, written to Drovide input to a processor hence, in other words, @ preprocessor is a processor to 8 processor. Inclusion of preprocessor also begins with a hash (#) symbol. But followed by a special word “define”. Hence, preprocessor declaration Is also known 5 global declaration. Since, the value once defined in this section can be applied ‘nce cannot be changes in the remaining program, Thaugh they can be declared anywhere in the program, but it is often good practice to declare it atthe beginning ‘The preprocessor offers several features called preprocessor directives. These directives can be divided into four categories: 1. Macro substitution directives. 2. File inclusion directives, 3. Conditional compilation. 4, Miscellaneous directives. Macro substitution directives: Macro substitution isa process where an identifier in @ program is replaced by a predefined string compased of one or more tokens. A ‘macro definition takes the following general form: #define Identifier String 4 wu haBanitcom (Ph: 040-6662 2789, 6662 3789a8 Kaban IT Training (Hyd) Pot Led Note: 1+ Sdefine is written just as shown followed by the idersifer and a string 4 Teshould not be ended with semicolon. {Atleast one blank space requlred between Identifier and a string 1 Thestring may be any text, which the Identifier must be a valid name, le Inclusion directives: This directive causes one ile tebe included In another, The preprocessor command for fle inclusion looks like this: #inelude “filename”. [And it simply causes the entire contents of filename to be inserted into the source ‘ode at the point In the program. It can be used in two cases: 1. If we have a very large program, the code Is best cvidec into several
Drint (KALYAN IT\9"; www Rebyanit.com (Ph: 040-6662 2788, 6662 3789"5 aa w 59 Kalyan IT Training (Vd) Pvt Lid ‘it and belif Directives ‘The #if directive can be used to test whether an expression evaluates to @ nonzero ‘oF not. Ifthe result of the expression is nonzero, then subsequent line up toa #else, elif (oF #endif are compiled, otherwise they are skipped. vod man) £ if condition statement; statement2; statement3; statements; statement5; statements; statement?; If the condition evabates to true, then statement 1,2 and 3 are compileG, otherwise welif will evaluates to true, then statement 4 and 5 are compiled , otherwise statement 6 and 7 are compiled Miscellaneous Directives: There are more preprocessor directives available, though they fare not very commonly used, They are 1 under 2 spreama 2 #eror Undefining a Macro: A defined macro can be undefined, using the statement undef identifier “This 5 useful when we want to restrict the definition only to @ particular part of the program, own RaSianit.com Ph: 040-6662 2789, 6662 3789Kalyan IT ‘Training (Hyd) Put £ ‘pragma Directive: The #pragma isan implementation oneal drectve that you can u fo tum on oF off features. Pragma vary from one compiler to another, Turbo C/Cs “compiler hes Got a pragma that allows you to suppress warning generated bythe compiler * fragma startup and pragma ext: These decive allow us to specify functor ‘thot are called upon program startup (before maln( ) or program ext ‘erogma wam: On compilation the compiler reports errars and warnings in th Program, If any. Errors provide the programmer with no option, apart fro correcting them. Wamings, on the other hand, offer the programmer a hint ‘suagestion that something may be wrong with a particular statement. Two mo ‘Common situation when worning are Usplayed are us under > Retuin type warnings. > Run-time errors, such as assigning a value thet never used. #progma waren! /* return valut/ pragma wem-par —_/*parameter not used */ #oragma warn-rch unreachable code */ vole it (3; void abet); pragma startup kit pragma exit ade Void main () Printf"inside main\n"); vola kit () « Drintiinsie kit"), old abet) « Printf*inside abe\n") > Output Inside kt insige main Inside abe www Kabjanitcom Ph: 040-6682 2788, 6662 3789com 739 Kalyan IT Training (Hyd) Prt Led Note: That the function kit() and abe() should not return any value. If we want two functions to get executed at startup then their pragmas should be defend in the Feverse order in which you want to get them called, ‘Stringizing Operator # : ANSIC’ praviding operator # called stringizing operator to 5e used in the definition of macro functions, This operetor allows 2 formal argument within 2 macro definition to be converted toa string “define sum(xy) printf #xy "=26N\n" xy) old main( ) ‘ sum(a+b); “This preprocessor wil convert the line sum(a+b) into printf ("a+b hich is equivalent to printf Carb=96"\n",2+D); web) ‘Token Pasting Operator ##: The token pasting operator ## defined by ANSI standard enables us to combine two tokens within a macro definition to form 3 single token, Ex: _// Hours to seconds conversion program// Binclude
Header file incusion decaration ‘define SEC 60 ‘1Preprocessor declaration ‘define MIN 60 1] Preprocessor declaration ‘void main() « Int HOUR=0, TIME_IN_SEC; printf"enter hours:") seanf(*36d",AHOURS); TIME_IN_ SEC=HOUR*MIN*SEC; print{("The time In seconds is 9",TIME_IN_SEC); ry www. obyenit.com Ph: 040-6662 2789, 6652 3789eee ee eee reece . Kalyan IT Training (Hyd) Pvt Led 16.Miscallaneous: A. Global varia Vs Local variable ‘Global Variable Local variable: 1. The variable which are declared above | a. The variables which are declared any function are called global variables. | within any function are called local variables. 'b, These variables can be accessed by al | b. These varlables can e accessed only the functions in the program, by the function in which they are declared 3 «Default value for global variable is__|e. Default value for local variate is 2000 ‘gafbage value. B. Necessity of main() in € + AVC’ program consists of one or more functions. One of them must be a ¢ maing) function, ‘+The main() function is a user-defined function which is called by the compiler to execute the program. ‘+ Im other words the execution of a'C’ program starts and ends with main). +The main() funetion can call other funetions to perform special tasks, There \ fore every 'C’ program must include main() function, ‘+ Every function returns some value. The return value for main() veld because It returns nothing. swe ebyanit.com Phi: 040-6662 2789, 6662 3789Static Vs automatie variables Kalyan IT Training (Hyd) Pvt Led arable [Sioase | Keyword [Storage [Spe Extent |Tritial lees Location value ‘Automatic |Automatic| Auto | Memory | Local tothe | The Garbage ‘variables block or function | automatic Inwhieh the | variable wil automatic be alive Variable Is uring Ceclared execution of black or function In whieh itis __| | dedaret toca | Memory | Local tothe | tisalive | Zero static block or function | between inwnien static | two variable ie function static | static ecared alls variables Accessible fram theplace of | Itisalive | Zero Memory | ceciarationto | during lobal entire program | execution stale of entire at proaram st wwe: Kebyanit.com ‘Ph: 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Put Led D. User-defined Vs builtin functions [User-defined functions [The functions that ate defined by the programmers according to the require- ments of the program are called "user- defined functions” [These functions can be modified by the programmers ie, they are modifiable They are not predefined. These are written by the programmers [White space.between the function names [and parenthesis () causes an error. User-defined functions can be overloaded. ‘The programmer is responsible for defining the user-defined functions, hence their definitions increases” the programmer's overhead, Not already available, hence are created when required ‘Their definitions can appear anywhere in 2 program. They must be declared before they are used, Example: display(); area); ete se Bult-n functions are commonly required functions that are net grouped together and are stored in a brary “These functions are not modifiable ‘They are predefnes. These are not written by the programmers, white spaces between the function names and parenthesis () are ignored In case of build-in functions | Builtin functions cannot be overloaded, Programmer's overhead is reduced here, | as they are avalabie 2s "ready-to-use" | funetions. Already available for the programmers focal. Their definitions appear in. standard Nraries Declarations of the bul functions are ot required. Example: cos(x), sar (x), sin(x), ete. www: Kebyanitcom ‘Ph: 090-6662 2789, 6662 3789| Kalyan 1 Training Pet, Ltda, Rypterobad | #202.MANENDRA RESIDENCY, 3° BUILDING FROM ADITYA TRADE CENTER AMEERPET, od HyD-16, Con. No.-9704177700, 7032300891 Unit -IIl C«DS By Mv. Katyan Reddy dard Pa: 6662 2789, 6662 3789 www.kalyanit.com com 3789Kalyan IT Training (Hyd) Pvt Led nit (Arrays) Tonic Page Ne Detrtion 8 Choracterscs of ray 3 (One dimensional onay 8 Aoyinitozation 3 Memory allocation for oray 58 2-dmersional ory 58 ‘S-dmensional aay 7 Aroys with functions: * 38 Ascays with pointers 8 Stings él Reading sings rom termine! @ Siting standard functions 8 Peiners “6 Insaation of pointer variables 6 ‘Atinmetic operations with pointers “ Pointers function argument 8 Pointer to function 70 Pointers & orays 70 Arroys of pointers n Pointers to pointes n Pointers & stings 73 Miszeloneous 73 DMA management 75 ‘Command ine arguments % www. Rabyanitcom ‘Phi: 040-6662 2789, 6662 3789LL Kaban IT Training (Hyd) Pvt Let ‘Arrays Definition: Array is a collection of similar data types in which each element is unique one and located in separate memory locations. These similar elements could be all ints, oF all, fats, or all chars, etc. Usually the array of characters Is called a string’ We can use arrays to represent nat only simple lst of values but also tables of data In twa, three or more dimension. ‘> One-dimensional arrays. © Two-dimensional arrays. © Multcimensional arrays. Characteristics of Array: Let us take the example int a(S]=(1,2,2,4,5); 1, The declaration int af] Is nothing but creation of variables of integer types In the memory. Instead of decaring five variables Tor five values, the programmer can Sefine them in an array, All the elements of an array share the same narra, and they are distinguished from ‘one another with the help ofan element number. 3, The element number in an array plays major roe for ealing each element 44 Any particular element of an array can be modified separately without disturbing ‘ther elements, If a programmer needs to replace 8 with 10, he/she need not Fequire to change all other numbers expect 8. To carry out this task the statement '(4]=10 can be used, Here other tnres laments are not dlsturbed. 5. Any element of an array a[] can be assigned/equated to another ordinary variable or array variable ofits type. Be: b=al2I; ata] = 213}; Inthe statement b=a{2] or vice versa, value of a[2) Is assigned to ‘b’, where “Bis an integer. In the statement a[2]=a[3] oF vice versa, value of a[2} is assigned to a3}, where both the elements are of same array. The array elements are stored in ‘continuous memory locations. ‘The amount of storage recuired for holding tlements of the array depends on is type and size. The tota size in byes for a single imensional array Is computed 2s: total bytes=sizeot (data types) * size of array, ‘One Dimensional Arrays: ‘Array Declaration: simple example of array declaration. int marks(30); Here, int specifies the type ofthe variable, just as it does with ordinary variables and the word marks specifies the name of the variable. The number 30 tells how many elements ofthe type int wil be in our aray. This number is on called the ‘dimension’ or ‘subscript’ of the aray. The brecket([] ) tes the compiler that we are dealing with an array. Subscript: ‘Subscript ofan array is an Integer expression, integer constant or integer variables lice‘ 'n” ete. That refers to different elements in the array. In the above example array subscripts start at zero. Therefore the elements are from marks[O] to marks[29]. Subscript 8 www Rabjanitcom Ph: 040-6662 2789, 6662 3789 eee saKabyan IT Training (Hyd) Pvt Led have @ range, starting from 0" up to the "sizeof array ~1". Subscripts can also be reflected Iioops that print the array elements, Array Init ization: Folloning are a few examples that demonstrate this, Int number(5]={ 2,4,6,8,10,12); int of}=€111,21,31,44,51); float pass{]=('12,3, 22.3, 33.3, 44.3); Int it[S]={5,15,25,35,45,55,65);, Note: + Till the array ements are not glven any specific values, they are supposed to contain garbage values. + the array is nitaized where it declared, mentioning the dimension of the {array is optiona as inthe 2” and 3° example above + Ifthe array is iritialized more than size of the array that is error. 4 Accessing array elements: ‘The elements of an array can be accessed using an index known as array index. The smallest possible value of aray index is known as lower bound. The largest value s known, {as upper bound. In *C* loner bound Is always 0 and upper bound IsN-1, where N is size of ‘ ary. Entering Data at Run Time: Here is the example to understand easly Here Is the section of code that places data into an array at run time. for(i = oj1<=29;1+-) { print *\n enter marks"); scanf( “ed, imarksfl] ) J ‘The for loop causes the process of asking for and receiving 8 student's marks {rom the user to be repeated 30 times, The fist time through the loop, has a valoe 9, 0 the sconf() ‘unction wil cause the volue typed to be stored in the gray element marks(0j, the frst element ofthe array. This process wil be repeated unt Y ‘become 29, This fs the last Une through the loop, whichis 2 good thing, aetause there is no array element ike marks( 30} In scanf() function, we have used the “address of” operator (&) on the element marks{i] of the array, just a we have used It earlier on ether variable. Tn 50 doing, we are passing the address of this particular array element to the scanf() function, rather than ts value, which fs what seanf() requires Reading Data from an Array: The Balance ofthe program reads the data back out of the array and used it to calculate the average. The for loop in much the same, but now the bod of the | loop causes each student's marks to be added to a running total stored in a varable f called sum. When af tie marks Nave Been aoded up, tne result fs divided by 30, tre hhumber of students to get average, 54 www Kabyanit.com Phi: 040-6662 2789, 6652 3789OE EEE ; Kalyan IT Training (yd) Pvt Cede for (i= oj 2v9=sum/30; rint"\n average matks = Sd * .2¥9);, ‘Memery allocations for array: Consider the following array deciaration: in ortsi, jwhat happen in memory when we! make this declaration? 10 bytes get immediately reserved in memory, 2 bytes each for the 5 integers. And nes Se array is not being initialized, all ve values present init would be garbage wohice This so happens because the storage class ofthis array is assumed to'be auto ies storage class is deciare to be statle, then the all the array elements were hats efault ind value as zero. Whatever be the ital values, al the array elena, Would alwoys be present in cantiguous memory locatlons, Tis arrangement of oer ‘element in tremoty is shown i bellow Whpre rena Boundary Checking In Array: In C, C++ there is: checks to see I the subscript Used for an array exceeds the sizeof the array, Data entered with sibscipt exceed the size ofthe aray. Data entered with a subscript exceeds the array ste wil sil be placed in memory outside the array, probably on top of other eas, or on bre rogram itself. This wil lead to unpredictable results, to say the less, ard thare wea 36.80 error message to warn you that you are going beyond the array aise. Te cone ases, the computer may just hang, Thus, the folowing program mayrtar oct fo he sual void main( ) £ Int numtso},; forti=0 ;1<=20;1++) um{i)=t; ‘Thus, to see to it that we do not reach beyond the array size, is sntirely the Frogrammer’s botheration and not the compilers Two Dimensional Array: The two dimensional array is also called a matrix. Two dimensions arrays are ectared a fllows : : Type array name row size}telumn sie); x in 8); ss sewn abanit.com ; Ph: 040-6662 2788, 6662 3789 >nner ee een eee eee Kalyan IT Training (Hyd) Pvt Ltd Initialization: Nien we are going to initializing the values we need to maintain row and columns by using curly braces and when the row is compiled close the braces, if you are using more ows end use separator (,) between. nt artata (1a420), (212,223, 3.33), wa18.aay % once an array is dedared oF Intiaized, let us see how individual elements in the array con be referred. This fe done By Using two subscripts, the number in fist subscript errata the rom address gné second one for colunn following the array name. This number Spectres the element's postion in the array. All the array elements are numbered, starting see pend O-Thus, ar{0}[0] isthe first element, arF[1][} Is fourth element and err{3}{2] Is the last element It is important to remember that, while jniiaizing a 2-D array, it Is fecessary to mention the sevand dimension (column), whereas the fist dimension is optional (row).Thus the decarations, Ine ar{2)(2)=(2,12,22,32); int art L2] =(3,23,23,33); are perfectly acceptable. Whereas Ine ar2it in ar 4.24.34); 15,2535); are not acceptable Entering Data at Run Time; Here Is the section of code that places data into an array at for(in0ri<=3ii+#) £ seanf( "96d" AarrCIDs > ‘Tne outer for loop to be repeated 4 times that is equal to number of rows and inner ¢ {or loop repeated 3 times that is equal to number of column in each row. The first time through the toop, | and j has @ value 0, s0 the scanf() function wil cause the value typed to be seared In the aray element ar{0][0), the first element ofthe array. This process will be Pepeated until j value become 2.Than outer Tor leep variable will be increment with one ‘TeRin inner loop repeated 3 times. This process repeated until outer lp becomes false. Memory allocations for 2-D array: Met Ue reiterate the arrangement of array element in a two-dimensional array of students, which contains rol o's ane column and the marks in other. ‘Fhe aay arrangement showin in Below figure 's only conceptually true. This is because memory contains rows and columns, In memory, whether Iisa 1-D or 2:D array, Pees tiemetes are stored In one continues chain. Te arrangement of array element of 2 2-D aray in memory i shown below: 56 sow Kabyanitcom ‘Ph: 040-6662 2789, 6662 3789\We can easiy refer to the marks obtained by the marks obtained by the Second student Using the subscnpt notation as shawn below: Printf("Narks of second student=2%d”,ar{ (1); Three or Multidimensional arrays: We aren't going to show a programming exemple that uses 2 3-D array. This is ‘because, in precice, one rarely uses this array. However, an example of inalaing 2 3-D array will consclidate your understanding of subscripts int amt T3IT2}=( anny, 223, Gx) (44a), (55), {6,66} 2.7), 18'88), {3:39} y A 3:0 array can be thought of as an array of arrays of arrays. The outer array has three elements, each of which is @ 2-D array of three one-dimensional arays, each of which contains two integers. In other words, @ .one-dimensional array OF two elements, is constructed fist. Then four such one-dimensional array are placed one below the other to Give a two dimensional arrays are placed ane behind the ather to yield a three-dimensiona frray containing three 2-D arrays. In the array declaration, nate how the commas have been given. How would you refer to the array clement 99 in the above array? The fist subseriot should be {2], since the element isin third 2-D array. The second subscrpt should be [2] since the elements In third row ofthe twa dimensional array and the tid subscript should s7 www ebyanit.com (Ph: 040-6662 2789, 6662 3789i Kabjan IT Training (Hyd) Pvt Lad ‘pressions refer tothe same element in the 3-D array. anall2}i1} “("(aretay sey ot) 1 lenguage allows of 3-D or more dimensions. ‘The exact limit Is determined oy he ‘ompier. The general form of @ mult-clmensional array is type arroy_name(si}(s2]is3]..fom); Wheres; is the Sze of the dimension. Arrays with functions: Array element can be passed to a function by caling the function by value, cr by ‘ference, In the call by value, we pass values of array elements to the function, whesrccory, the call by reference, me pass address of array element tothe function. These too cals wre ilustrated below 17 Demonstrated of call by value */ Void KIT(int); void main( « ‘nt marks{6}=(55,66,77,88,99,100}; for (i=0;1<=5;1+), » Kimani: ove KETC int +) t print M40" 9); Here, we are passing an individual element at a time to the function KIT( ) and {getting printed In the ‘unction KIF ). Note that, since ata time only one element pon assed, this element is collected In an arcinary integer variable in the function aC). 7 Demonstrated of cal by reerence ‘oid display(int *);, ‘eid main( ) 4 Int marks[6]=(55,66,77,88,99, 100}; for(i =0;1
Hincudecstring n> yod mand veld maing char on(20},dupt20};, char uppert15}; crserQ); ser); Drinti(\n enter ur name:"); Drinkin enter string in lower cases"); 4 saets(or); ‘9ets(upper); - strepy(aup,or); Drink after strupr): 9s" strupr upper) Drntt"original string: %s" or); y 4 Print(“dupicate string: es" des) > > output: enter ur name: SACHIN ‘orignal string: SACHIN, output: ‘ulicate string: SACHIN enter string in lower case: abede ‘after strupr): ABCDE © stelen(y: 1. strehro: 4incudecstring.h> findudecstring.h> yrdmaing eld mand char strf10]="Usha Rama’ ‘har string 30}, rchp; int Drinti("\n enter texts); Lestren(str, sels(string); Print("String lenght=%d",L); Dri character to find"; chegetehar(); ehp=strehr(string,ch); ren) Print(“character Mee found”); else Drintf(character not found ch); Output : enter text: KALYANIT character to finds ¥ eharacter ¥ found 64 swuvw Rabyanitcom Ph: 040-6662 2788, 6662 3789Kalyan IT Training (Hyd) Pvt Led fe. stremp()t fe streat(): ‘irclude
#Fincludecstring.h> void main() veld main¢ ) { { har souree[10]="Usha Rama"; char source{0}=' Rama"; har destination{10]="Usha Rama"; ‘char destination(i0}—"Usha mt streat(destination source); ‘stromp( source, destination); print" Source string es", Drntf\nd6d", “souree); "stromp(souree,"UshaRtama") ritf("\h Destination string=%6s", pnt” es, destination); > > Outout Source sri Destination sting Pointers Definition: 2 pointer is a memory variable that stores a memory address. Pointer can have any name that fs legal for other variable and it Is declared in the same fashion lke other Variables but itis always by *” operator. 4 pointer is a derived data type in C, itis built from one of the fundamental data type avilable in C. Always @ pointer stores memory address. Features: A pointer save the memory space. Execution time with pointer is faster because data Is manipulated with the address le. direct access to memory location. ‘The memory is accessed efficiently withthe polnters. The pointer assigns the ‘memory space and it also releases. Dynamically memory Ie allocated Pointers are used with data structures. They are Uselul fer representing two- dimensional and mul-dimensional arrays, 6 tion: The declaration ofa pointer variable takes the fllzwing frm: data_type * pointer_name; +The asterisk (*) tells that the vanable polnter name is pointer variable. Pointer name need a memory location ‘+ Pointer-name points to a varble of type datatype In the frst statement ‘xis an integer pointer and it tells 20 the compiler that Ik holds the address of any integer variable. In the same way "Fis a float 6s Phi: 040-6662 2789, 662 3789ee eee rte ee ere eee nee eee Kalyan IT Training (yd) Pot Lid pointer which stores the address of any float variable and 'y’ is @ character pointer that stores the address of any character variable, '. The indirection operator (+) is also called the dereference operator. When & Dointer is dereferenced, the value at the address stored by the pointer is Fesrieved. Normal variable provides direct access to their own values whereas a pointer Provides indirect access to the Values ofthe variable whose adress i sores 4. The indirection operator (*) Is used in two distinct ways with pointers, declaration and reference, '& When @ pointe i declare, the star inaleates thats a pointer, not a normal variable. , When the pointer is dereferenced, the indirection operator incicates that the . Value at that memory location stored in the pointer isto be accessed rather than the aderess itself, ; 9. Also note that * is the same operator that can be used as the multiscation ‘operator. The compiler knows which operator to call, based on the context Fh. The 8"Is the address operator and it represents the address of the variable. ‘The "ou is used with print() function for printing the address of « variable. ‘The address of any variable Isa whole number. The operator °° immeslately preceding the variable returns the address of the varsble, |. We ean declare the pointer variable In 3 forms: int, "ptr Inet, ptr ine + bers | Initialization of pointer variables: ‘The process of accessing the address of a variable to a pointer variable is known as, initialization. All uninitialized pointer will have some unknown values thet wil be interpreted a5 memory eddress, Once @ pointer variable has been declared we can use the assignment operator to intiaize i the variable vyolé main () € inti ine *ptr, : Note: ‘+ We can combine the inivization withthe declaration, That is int *pte=8i; 66 www Rabyanitcom Phi: 040-6662 2789, 6662 3789aa am Kalyan IT Training (Hyd) Pvt Cu ‘Accessing a variable through pointer: ‘Once a pointer has been assigned the address ofa variable, the question remeins as to how to access the value of the varlable using the painter? Ths is done by Using anther ‘operator *, usualy know as the indirection operator or dereference operator, oF object at that locaton void main () « Ine nv*otes pial eas, nest ‘The first line deciares j, and n as Integer variables and ptr as peinter variable which points to integer valve ‘The second line assigns the adéress of | to a pointer varable pir ane the third line assigns the value 25 to i. The fourth line contains the Inditecion operator *. When the ‘operator * is placed before a pointer variable in an expression, the pointer returs the Values of the variable of which the pointer value is the address, In this case *ptr returns the value ofthe variable |, because tris the adsrese of 7 simple example with pointer "7 void main () int ab; int *per; rit Sed 96d 2,0, > output: 3040.40 {Any type of pointer size is same because it stares the address, + On O08 based compilers pointer size i 2 bytes, This all are unsigned values 0 to (65535, Total address are allocated at runtime is 65536. + On UNIX based compiler milions of addresses are avallable, and pointer size is 4 bytes, All the pointers have same sizes because they are storing similar values. But there is necessity fo store address of character in chart, address of integer in int ‘and float address in float*The diference is seen when we pointing the variable by www Kabjanitcom Ph: 040-6662 2789, 6662 3789% i + Kaban IT Training (96d) Pvt Lid {ising * operator. For exemple if we are using char* pointer to hold integer address then, when we using * operator than It points st 1 byte ony Rules for pointer Operation: ‘Two pointer variables cannot be added. A polater variable can be added or subtracted with an integer value. A pointer variable can be subtracted with an integer values ' Two 2ointer variables, a pointer variable with an integer value cannot be sty 4 pointer variable can be assigned the address of another variable, A pointer variable can be pre-fixed or post-fixed with increment or decrement operator. 2. We can compare pointers using equality ang inequality operator. 8. A value cannot be assigned to an arbitrary address (Me. foe 10y is egal), Arithmetic operations with pointers: {Arithmetic operation on pointer variables is also possible. Inereast, decrease, prefix '& postfix operations can be performed with the help of the pointers Data tpe [i ‘Operation “Address oer [Required Adress aperations | bytes inti=z [aoe = ag Pao 3 Ghar cae | 4053 + —|08¢ F053 Moat [4058 + =~ [4062] 4084 f232 {long i=2 [aoe = 06405 14 x: Arithmetic operations using pointers. fincude
include
ola main() « int 3°25, b=10, *p, "4; pata; pat ales), Dri#f"\n addition of at baka); retf"\n subtraction of a-b=%0" 4p); Pnt(-\n product of b= aod""ph), Pant division of a/b 9%"."p ] “hs Drinf("\n a mod b-bd p96 *f)¢ Output addition of atb=35, Subtraction of a-b=15, Droduct of 9 division of a/b=2 amoa bos) 68 www Kabyanitcom Ph: 040-6662 2789, 6662 3789a Kabjan IT Training 06d) Pre Led ‘Addition: & number can be added to a pointer or addition of two variables through pointers 's also possbie. Inthe hist pant) statement value ofb'Is added to pointer of 2" he, *p. Subtraction: A number can be subtracted from a pointer. Subtraction of two variables through poitters is also posable. in the second print) statement value afb" fs subtracted from pointe ofa’ Le. Multiplication: Mutiplication of two pointers or a multiplication of number with pointer Variable car be cone. In the third print() statement multiplication of vaiahia°y” nnd" ‘done through thelr pointers +p" and =F Note: The filowing things are not possible. 1, Addition of two addresses (pointers). 2: Multiplication of addresses or multiplication of address with a constant 3. Division of address with a constant, Pointer as function argument: Arguments can ganerally be passed to function in one of the tw waye {L Sending the values of the arguments. 2. Sending the addresses of the arguments. Inthe first method, the ‘value’ of each ofthe actual arguments Inthe calling funetion 's copied into corresponding formal arguments of the called function. With this method, the changes made tothe formal arguments in the called function have no effet on the values of : actual arguments in te called function. The following program illustrates the ‘all by value! ’ or pass by value’ ‘The value of vi and v2 remain unchanged even after exchanging the value of ni and n2 oid swap(int nt, int n2) « toni; nina) rast; Printf(\nnt=9%d n2=%6@",91,02); ld main( ) int viva; In the second method (cal by reference),.the address of actual argument in the ‘aling functor are copied ito the formal argue ofthe called funcion This Means tha ‘sing these addresses, we would have an access to the actual arguments and hence ws ° ww ajanit.com Phi; 040-6662 2789, 6662 3789: Kalyan IT Training (Hyd) Pvt Led would be able to manipulate them. The folowing program illustrates the ‘all by address or “eal by reference’ Word swapcint “pi, Int "p2) { Int ts tp: * “pest; } ‘oid main ) ¢ ine viva; vai; 12520; ‘swap(vi,8v2); PARE WWI = 9d V2=%6d v1.92); > output: 3220 Note that this program manages to exchange the values of VI and v2 using their addresses stored in pl and p2. Pointer to function: A function, ke a variable, has type and an adaress location n the memory. Ts therefore, possible to detlare @ painter to function, which can then De Used 283 en argument in another function. A pointer whichis pointing to dead location 1s called dengling pointer. ofan) retum 8a; + ‘void mang) In *ptr; erst votr=35; Print 966" *ptr); Pointers and Arrays: Array name by itself Is an address or painter. It points to the ‘adress of the first element (0") element of an array. The elements of the array together with their adresses can be displayed by using array name itself. Array elements are always, ‘Stared'in contiguous memory locations, 70 www Kebyanitcom Ph: 040-6662 2789, 6662 3789 iOe Kalyan IT, Training (yd) Pvt ced Birdlude
include
STTURI, Displays various array elements, Here ar’ refers to the address and ‘prefers to element number, W\n"p.8arrtp)); plarrl: This s same as base address. By varying rrfpl here, prefers to the element number and ‘ar’ refers to the 19°p" and ‘ar’ the various elements ofthe array are Gupleveh Ext Two dimensional arrays with pointer fincude
include coniosh> void main() ‘ lott (nt 313113) (04,2,39.(4,5,6).478,9)) crser) Daintf(*\t elements of an array 7 with their addresses. \n\n"}; fortie0;i<9;i0-) { print(“968u" a(03(0}+%); rent 15d) Bal0}0}+0); i printt\n"; > Output: Elements of an array with their ederesses. {40521 274054) 3¢4056) 414058] [4060] 4og2} 7a064] [4086] 914066] Array of pointers: It is nothing but a calletion of addresses. Here, we store address of variables for anich we have to deciare an array as & pointer n www: abyanit.com Ph: 040.6662 2789, 6662 3789x: void main() Ine *arrpt 31; Int arr3}=(5,10,15),4; for (k=0;k<3;k+-+) ammptkd = arr; Kalyan IT Training (Hyd) Put Led carser(); Drinti(\n\¢ address \t element\n"); or(k=O;ke3;k+#) { printt(\etu", aero); Drinth-\9674\n",*(aArBLKD): . > x Output: address clement 4060 5 4062 10 4064 a5 Hemant No. array of Values [ Flement No. ‘Arey of aderesses_] arid] 5 artp(0] 060 sri] 10 ‘arp 4062 arri2] —hs arr2} 4054 Pointers to pointers: Pointer is known a a variable containing address of another variable. The pointer vorfables also have an address. The pointer variable containing acdress of other pointer Ns chain can be continued to any extent. Venables is called as pointer to pointer. Th ‘Address3 ‘Address? Here, the pointer variable ptr3 contains the address ofthe pointer variable tr2 and pera contains the aadress ptri which Is pointing to a variable. This is known as multiple Indirections. [A variable that isa pointer to a pointer to pointer must be declared using adltional ‘Adress Indrection o2erator symbol in front ofthe name, n { Value ‘| sew Kafanit.com Ph 040-662 2789, 6662 3789 a!Kaban IT Training (Hyd) Pot Ltd ‘7° Example for potter to pointer concept void maing ) < ine In ptr; int spp; Int #** paper; pera Potr= Soir; optr=Bopte: Fas; Drintf(54 96d cl Sed, *pte;**pptr,***pppte), Pointers and Strings: Pointer usage on strings is similar to arrays only xt void mang) ‘char namef5], "eh; pantf(enter U name! ‘gets(name); chename; ‘whiten "7 printf" eh); ents {an array is 2 collective name given to a group of similar elements, whereas a variable is any entity that may change during program execution, An array is a variable that is capable of holding many values. Whereas, an ‘ordinary variable can holé a single value at time. For example, an array Initialization would be, Int number(8]; for which there are eight storage locations reserved where eight different values can be stored belonging to the same type ‘Whereas an ordinary variable Inivalization would be, ine number; and’ only one storage location is reserved and can hold only one value ata time, 2. Effect of following statements: a int a, *baea;: “2's an integer type Le, ‘ais capable of holding an integer type value. The variable "Is a pointer variable of type Int containing the address of 2 www fabjanitcom Pi 040.6662 2789, 6652 5789Kalyan IT Training (Hyd) Put Ltd bi int py Compiler shows an error, because same variable is used as both normal and pointer variable, & char *5;: Specs 's! as a ‘char’ pointer Le., variable “s’ contains the address of @ “enar’ valve, 4. a=(float *)ax; : This stitement assigns the address of the variable x to is casted with float, hence, 'a" contains Noat values. ‘The contents ofa" - Effect of following statements where m and n declared as integers and pi and p2 as pointers to integers: ‘This Statement assigns the address of variables m to the pointer variable pi ‘and p2 is sid to "paine to" rm, b. Ps Assigns the value of variable ‘n’ to the pointer variable 92. Since, ‘nis not Intaized; » garbage value stored inn’ ts assigned to potter © Mep2-pi;: Finds the eiference of two pointers and assigns the resultant address as @ value tothe variable m 4. *pizan; Assigns the address of n to the pointer variable pl so the value at pointer pi isthe address of - Some important functions and thelr functionalities: sgets() ~ puts(): gets): Ie colle a string of characters terminated by @ new line from the standard input stream stdin and put Ie nto "s. gets() replaces the newline by a null character (\0) in 's', it also allows. input songs’ to contain cersain,wnfecpoce characters (speces, tabs). gets() returns when it encounters 9 newline, everyehing ‘p to the newine i copied into puts: 1 copies the nul-terminated string ‘sto the standard output stream stdout and appends @ newline character Return Value: ‘gets() returns the string argument 's’. On enc-offle or eror, gets retums null. Puts() returns a non-negative value. on efror, puts relums 9 value of EOF, www Rabyanst.com Phi 040-6662 2789, 6662 3789Kalyan IT Training (Hyd) Pot Led B. gete() ~ puteg: sete: Tis a macra that gets one character from a stream, getc() returns the next character en the gien input stream and Increments the streams file pointer to point the next character. getel) returns the cheracter read, after converting It to an Ink without sign extension. pute: 1s @ mace that outputs a character toa stream. putc() outputs the character given by to the stream given by stream. pute) returns the character ‘Siven by c. On error (and on end-of-le for getc(), Both functions return EOF © getchar() ~ putchar(): etchar(): getchar() == scanf("96e",ch) Here only erter key Is separator. Whereas for scarf() tab, space, enter key ‘are seperators, getchar() Is a macro that gets a character from stdin. getchard) is 3 macro defined as getc{stdin), getchar() returns the next character on the Input Stream stdin, getchar() returns the character read, after converting it tO an int without sign extension, utchar(: utchar( is a macro that outouts a character on stdout. putchar() is @ macro defined as putc(c, stdout), putchart) puts the character given by con the output stream stdout. putchar() returns the character given by c (n error (and on ent-oF-file for getchar()), both macros return EOF. DMA Management ‘The Dynamic memory management Is basically used to calculate runtime ‘memory requiremerts. With this we can aot only saves the amount of effort needed Wille developing the program but also saves us from recrulting the entire procram, Basically there are two major functions namely malloc!) and calloc() referred "9 be ‘éynaimig memary management functions matloc(): Tk reserves contiguous block of memory whose size In bytes is specified at “memory size”. When & program obtains a memory block through maloc(, it contents remains undermined. malloc) takes one argument and alocates getboue Value Initially, Syntax: old *mallocsize_t memory_size); ex Ine *arr, arr=(int *)malloc(na * sizeof (nt) calloe(): Te reserves a block of memory whose size in bytes is atleast count x size. In other words, the bleck is large enough to hold an array of count elements, each of which Takes! up size in bytes. calloe() takes two arguments and- allocates. reroes Intl. 1s swwvwaBani.com Ph: 040-6662 278, 66623749——— Kaban IT Training (Hyd) Pot Led Syntax void *calloc(size_t count, size_t size); & int are: ‘arr=(int*) elloc (no, size of (int); realloe(): Tf causes resizing of allocated memory block. The below example goes to new memory address and fist place occupied with olddata and returns emore node, oar’ (Here 100 requires extra memory), int Farr; ‘art=(Int *) relloc(ar,100); free): causes releases of already allocated memory block, Bentsen; free(arn); ‘Above all four functions are available in stlib.h header fle ‘Command line arguments ‘Arguments passed toa program ffom the command line are known as ‘command line arguments Programs written in °C’ language can algo be invoked with the command tine arguments. In this case, the operating system provides the Information akees wee ‘guments to the main() function. On the ether hand the main) neton wooo ve Geciared with two parameters ie., argc and argu). argv{} stands Tor mete oe ‘argument, In © and C+. Whereas it Is 0 in Jove. Using ssible to create your own commands end ea cum Be include
include
Yoid main(int arge, char *argv{)) £ Ine DBrinti\n number of arguments » Sid \n*, Sige Drintthe arguments passed are"); Drint\n"); for(=0ji
struct t | ¢ Int car; struct time st; struct time et; » ” sw aban com 0406662279, 6652 3789Kalyan IT Training (Hyd) Pvt Ltd fe know that pointer isa variable that holds the address of ‘nother data variable, The variable may be of any data type Le. int, float or double, In the same way we can also define pointer to structure, Here, stating adcress of the member Variables can be accessed. Thus, such pointers are called structure pointers, x: struct book { char name(25]; char author(25); Int pages; cH Struct book “ptr; ‘+ In the above example *ptr Is pointer to structure book. The syntax for using pointer with member is 35: 1) Pir-> name” 2) ptr-> author 3) ptr -> pages. Structures and functions: Like variables of standard datatype structure variables ‘alse can be passed to the function by value or adress, = passing adress of structure variable */ Sindude
include
struct book { har namel35]; char author(351; Int pages; void main() q struct book b1= (JAVA COMPLETE REFERENCE", "P.NAUGHTON", 886); sow (bt); | > show(struct book *62) ¢ arserQ); Drintf"\n %6s by 9s of ted pages *,b2->name,b2->author,b2-> pages); | > ‘There are cifferent ways of passing structure type arguments to functions. These are given | below: 1, Passing structure members individually: Each member of structure can be passed individually as arguments In the function call and retained through return Statement. 2. A.copy of complete structure can be passed as argument using call by value ‘method: Using this method, a copy of entre structure is passed fo function but any ‘macifications made to It wil not be reflected inthe called function | 80 wu fefyanit.com Phi 040-6662 2789, 6662 3789 ainda idl atta acai od: Kalyan IT Training (yd) Pot Lee 3, Pass the address of structure to the called function: This method Is more efficiene than the second method because structure need not be retured to called function. In this approach, the adéress location of the structure Is passed to the called Ninction. Self referential structures: 1. A self-referential structure js one that includes within its structure atleast ‘one member whichis pointer tothe same structure type. 2. Sell referential structures are mainly used in the implementation of data structures. Ex: linked ists, tees, ete. 23. Ex: struct student « char name{S0}; Ine rol; Struct stent *ptr; h unign Union is variable, which is similar tothe structure, It contains number of members lice structure but ft elds only one object at a time. In the structure each member hes its ‘onn memory location whereas, members of unions have same memory Yocetions. It can accommodate one member at a time In a single area of storage. Union also centaine members of :ypes intflatlong,arrays,pointers etc. It allocates fixed speciic bytes of memory for access of datatypes lrespectve of any data type Union requires bytes that are equal to the number of bytes required forthe largest ‘members. For example the union contains char integer and long integer then the number of bytes reservee in the memory forthe union Is 4 bytes. Declaration: union
tag is optional « datatype member; datatype member2; datatype member os ‘Access: Accessing of members of union Is done similar to that of structure, it Is done by using dot(.) operator for unions and using >for pointer to nions Example: union organization char name(251; char designation( 10}; ine sal, » union organization emp3=(°RAMU"secretary",8000); union organization emp2={*GOPAL“ "managers, 15000); 81 wore Robynit.com Ph: 040-6662 2788, 6662 3789Kalyan IT Training (Fd) Pot Ltd ‘typedef: By using typedef we con create now dato type (Eg! Int, pointers ant ‘structures). The decaration for the typedef Keyword typedet
; Bx 8) Creating new data type int” ‘typedef int integer Now integer is the srnonym for int. Integer can be used in declarations. Exc integer x,y.25, by Using typedef for pnters typedef int * integer; This statement makes integer 28 a data type which is similar to integer pointer (Int =). Now tis integer can be used for the declaration of integer Pointer. Ex: integer Pt; ©) Using typedet for structures. typedef struct student * st_pointer struct student c char name(S0}; Int raling, st pointer pt; Bit-fields: Bt felé provides exact amount of bits required for storage of values. A bit-feld Js. set of adjacent bits within a single machine word. Be-elds are mainly used vo save te ‘memory space or to combine several states of Information within a single machine word. ‘To hold the informetion we use the variables. The variables occupy @ minimum of fone byte for char and two bytes for Integer. Instead of using complete integer if bits are Used, Space of memary can be saved. Declaration: Declaring structure using bt-felés. struct student ‘ unsigned gerder : 4; Unsigned grate : 2; “The colon indicates the usage of bit-elds and the number fllowing It represents (tells to compile) the wlcth ofthe fieldin bits, However there are restrictions on bit elds when arrays are used. Arrays of bit elds are not permitted. Also tte pointer cannot be used for addressing the bit field direct, although the use ofthe menber access operator (->) is acceptable 2 wr Kebyanitcom (Ph; 040.6662 2788, 6662 5789Kalyan IT Training (Hyd) Pt Led Miscellaneous: ‘8 Enumerated date type: The enum is 2 keyword. It Is used for deslering ‘enumeration types. The programmer can create his/her own data type and define nat values the veriables ofthese ata types can hold. Ths enumeration data type helps in eading the program, enum month (Jan, feb, mar, apr; may, Jun Jul, aug, Sep, eet, nov, dec); ‘This statement creates user defined data type. The enumerators are the Identifers jan, (eb, mar, apr and so on. The values are constant unsigned integers and stare rom 0. The identifier jan refers to 0, feb to 1 and so on. “The Identifiers are not to be enciosed with in quotation marks. Please also ote that integer constants are also not permitted. '. Advantages of structures over arrays: 4, We,can group items oF elfferent types within a single entty, which is not possible with arrays, es array stores similar elements, 2. The position ofa particular structure type Variabie within a group Is not needed in cider to access it, whereas the position of an array member in the group Is Fequired, in order to refer to it 3. In-orler to store the data about @ particular entity such as a ‘book’, using an array type, we need three arrays; one for storing name, anather for price and third one for number of pages ete. Hence, the overhead is high. This overhead can be recuced by using structure type variable i.e. array of structures 4. Once'a new structure has been defined, one or more variables con be declered to be ofthat type. SS. A structure type variable can be used as a normal variable for accepting the ser’ input, for displaying the output etc. 6. The assignment of one “struct” variable to another, reduces the burden of the programmer in fling the varable's feds again and Soi, 7. Itis possible to initialize some or all elds of a structure variable at once, when it 's dedored, ‘8. Structure type allows the efficient insertion and deletion of elements but arrays cause the inefficient. ‘9. For random array accessing, large hash tables are needed, Hence, large storage space and costs are required o.Wher 2 structure variable created, all of the member variables are created ‘autoratically and are grouped under the given variabe’s name, 8 sw Kafyasicom Ph; 040-6662 2788, 6662 3789Kaban IT Training (Hyd) Pvt Led * ‘e Structure Vs Union: ‘Structure T Union i. Sadaration i Dedaration: Sod lage ‘nto ‘ ‘ datatype member; datatype members; fata type member; ‘ata type member » y 2 Every structure member i 2. The memory equivalent tothe alceated memory wen 9 largest tems allacated certrony Strocure vorisble sdf feral members ee & Shuck tron « ia € a char t int x; int x; ; fost v: fost y: j ds: us vetory alocted for ss 7 Memory located tous 4 bytes. (ieee bytes 3 3, Althe members canbe 3: Only one member canbe assigned signee vues aa tine ve a ine 4, Values asianed to one member | 4. Value assigned to one member wil not ene the change in Inay use te change tae of ‘ther members other members. i 5 Al structure variables canbe | 5, ony one union member ean be invavzed ato tine inte at me 6. The usege of structures 6. The vaage of urion I cont cen ena memes re when members oF are not betty uses inte pogo ‘erulred to be accessed at the | _he'tine ‘4. sizeof: We normally use structures, unions, and arrays to create variables of large sizes. The actual size of these variables in terms af bytes may be change {rom machine to. machine, We may vse Ute unary operator ‘sizeof to tell us the size of 2 structure, The expression sizeof(struct x) will evaluate the number of bytes Fequired to hold all the member of te structure ' t \ . | L 8 ww kafyanit.com Phi: 040-6662 2789, 6662 3789IT Tacining Pat, Lad, #202, MAHENDRA RESIDENCY, 3 BLILDING FROM ADITYA TRADE CENTER.AMEERPET, | HY0-16, CoN. No.-9704177700, 7032300891 UNIT -V C«DS By Mr. Katyan Reddy Ph: 6662 2789, 6662 3789 www.kalyanit.comKalyan IT Training (Hyd) Pvt Led UNIT-V (Files) Topic Page No Definition 85 Basic operations on fle 85 Fles modes 8 Binary modes a Fle functions | a Streams 90 Types of fies 7 %0 los 0 Error handling in ¢ a sw Rabyan.com Pi 04066622789, 66623769Kaban IT Training (Hyd) Pve Lad Files Definition: Fie is a set of records that can be accessed through the set of library functions Basic operations on a file: The basic operations that are performed on the file are, ‘Opening a fle Reading or writing a fle Closing fle. And also need to fulfil three important points Naming of fle Data structures of fle Purpose of fle 41. Naming of file: Te fle name must be specified for a particular fle. The file name is typically string of characters, Ifthe files used for storing text we use tx for C programs we give "for header fle we give“ extension and 80 an Ex: "data.txt "add.c” oF "prin? and so an. Data structure of file: FILE is the data type define fore file, ‘Syntax: FILE pointer type. xc FILE “pL; //where pt’ Is the polnter to the FILE structure, Purpose of File: Here the fle should be defined whether the file is to be "ead, written or appended by defining the maces. | i. Opening file: File is opened by using fopen) function with two parameters 1. File name, 2. File open mode, For opening'a fle, request has to be made to operating System. The operating system grants the request by pointing to tre structure ILE” and rejects the request by returning a NULL’ values Syntax: FILE fp; tp=fopen(tile_name, mode); Be FILE *; Ip=fopen("flesot*r" ‘The fopen() function is defined in the "stao.h” header fil. The “fle_name” Darameter refers to any name of the file with an extension such as “flle.txt” oF abed.c" and so on. File open mode fefes to the mode of opening the fil, The fle «an be opened in "read mode’, write mode’ of “append mode’ and sls ie can be ‘opened with a combination of any two modes out ofthese three, 2 Once the fle 's opened the associated pointer points to ‘starting character of the fle contents, This whole file can be read by using various functions provided by the‘ standard library (Ex: faetet);) Toetc() read the character pointed by fp, and the pointer positon gets incremented, ‘ov holds the character read from the fle For writing data Into the opened file we caa use the fpute) function. x: fputc (ch fp); Where ch’ isthe character to be written into the Ale 85 www fabjanit.com Ph: 040-6662 2785, 6662 3789Kalyan IT Training (Hyd) Pvt Led Closing @ file: After the required operations such as reading, writing or appending ‘operations on a file are done, the file needs to be closed with the assoclsted pointer. ‘Syntax: felose (Rle_pointer); Be felose (1); ‘To close more than one file a atime, we can use feloseall) function. '% Text modes: write, read, append, writetread, appendreed, read + write modes File Modes: a, Text modes . Binary modes avaliable in text modes. rite (ww): This mode opens a new fle on disk for writing, If the fle already exist, ‘willbe over wetten without confirmation | Bx fpmfgpen (data.tet,*w") read (F): This mode opens a pre-existing fle for reading, Ifthe file doesn't exist, then compile returns NULL to the fle pointer, Be: fp=fopen ("éatatst”, *r"); 1 ip==NULL) Printf("ile does not exist”); append (2): This mode opens a pre-existing fle for appendiig date, If the fle dovsn’t exist then new fle Is opened ie. If the fle does nat ext then the mode of “at is same as "W", Bef pen (*data.txt,"0"); write+read (w+): It searches for fle, f found its contents are destroyed. Ifthe file isn found @ new file's created. Returns NULL i fails fo open the file. In this mode fle can be viritten and reac, Bx: fopen(*data.tat “w+ Ppend+-read (a+): In this mode fle can be read and records ean be added atthe end of fle Ex: fp=fopen(*data.txt","34"); Feadstwrite (+4): This mode s used for bath reading and writing. We can ‘reed and write the record in the file. If he fle does not exist, the complet returns NULL t the fle pointer. {«:fopen (“data.dat,"r+"); itfp=
‘hen, feof) retuns a zero if end of ile isnot reached, then the” Dperator Is used to negate this, zero to the truth valve Teror I. ferror() ig standard library funetion whieh finds the ertor when read/wnte operations are ‘cried out in fle 2. ferror() returns a zero if read/wnte operation Is successful fang a non-zero value in case of fallre of read/wnte operation 3. Example of error) while(eot(f)) « etc); itterrorO) printi(ero"); break; > > www fabjanit.com Ph: 040-6662 2788, 6662 3789ee ee Kalyan IT Training giyienina)®T10. 202 Maden Reine 3 otang rm Aig Tne Cntr, Amcorpet-16 warealyantcom FILES FROGRAMS ONG Foran dnt cout MrKalgan red) Matnaanolaoom Ph: 9704177700,6662 2789 HOE co include
fineludeproces.i> void main) FILE “ip: clrserQ; fi-fopen("e\L tt" ‘f(g NULL) fl print {"nFILE NOT CREATED"); ) {printf HELLO %d KIT %d", 10,20), {printip,"WABCD"); fetose(D): eetehs } iitTEW2.CUASCH CHART PRINTOUT tinclude
Finelude
‘void main() lise Fpefopent"esl tw" itfp=NULL) { printf("nFILE NOT CREATED"Y etch; exit); } on i=-128:<=12754+4) Sprites feloseD): etch } iiit"PRIME NO PRINIOUT. Ci tinclude
include
void main() Tong int ntn2,n.counter0,.fiag; FILE “i clrser) Aprfopen("eA\.exts"w"); print “ENTER TWO NUMBERS") scanf{"%ld%6ld en, 8n2); frgentnea) ‘ag=1; for(t=2st
inelude
void main() { FILE “ps clrser0s p= fopen("c:\TEMP6PMO.¢x if{ip=-NULL) or sounter ns 0 ‘rint("aFILE NOT CREATED"); fetch; exit ) {print "wHELLO KIT"), felose(fp); etch); } TERA CHINHREADING TXT FILE Hineludestdio.h> Finclude
void main) { FILE *fp; char eh; ‘har fame 100):ininl-o; ales; coms, ita emAnTER MLE NAME = ramos Moa fe~ vee) a mes tr NULL) ees “ny piniwFLE NOT AVILABLEM, Mog 28 ch-8e reac) getch(; C en ‘ws ; ae while(1) d t 3 Safest eno oF CHARS ste) nifonn0 OF SS ein print("\aNO OF LINES=%d".) print"\aNO OF TABS =%d";m);, Printi("NO OF NAL =Y%d',nal); Drnt"inNO OF WORDS=%4d" ny); felose(f); ) etch; ‘iiWHI4PR2.C POR GETTING TOTAL TXT INFO } OFFILB// includetdio > ONLINE.CH/il(FOR ONLINE EXAMI finsludeprocess > include dio > inslude
finclude-process b> void mang, inclade
‘ void ming) TILE "ip; t FILE ip; char ch; int ag-0; int secs; lsc fp-fopent"eivest! clser() sRGp=NULL) prini"™aDATA NOT FOUND"); etch; : a printf(\aFILE NOT AVILABLE’ prin*ENTER TIME IN SECS") exit) Scania", &see8} } inion swale) while) t ceretgetep)s ch fgett tp) feof) ) AN feomtp)) break;mt We fag ifhDag—=0 ee ch) t delay(sees*1000), no } ‘nan fosetp); eley(5000);, siecarwenspc cousin include
‘nclude
Wincludecalloe:h> vues void strep(char*ptr.char cht char ch2) i fonts) © ittptemeht) *purmchas } ‘wos vid main() i FILE “fp: xarch.chl hd; har fame[200); lang faze nO; eer); pint{"\nENTER FILE NAME:"} cn" NUL) t vin WFILE NOT FOUND", Sy } pritf("MENTER CHAR 1 2"); prin("inENTER CHAR 2 ="); Masha; ch2=getchar): fivek(ip.0,SEEK_END); fize-Rellp), feek(ip,0SEEK_SET); st=(char* mallo( size), enact wile) t chtgete(fp)s iff fot) ) break mir seit: anoanca ‘eck( fp,0SEEK_SET); stirep(trchl ch), {peiatifp. "6 st), feloso(); ees antannBUPLR CH fincludecstdio.h> finclude
Fincludecalloc > void amps 0) fon(pepe) cl iffepte-~A'eperZ) purt=32; elseif(*ple-= pee) Spue=32;, ) ) noone voit mang FILE *ip; char ey har fnume(200);, char sr, long fee i-0; cltse(), prt f"ENTER FILE NAME: gets Thame); fp-fopenttname,*r+"); iftfp=-NULL) t print .nFILE NOT FOUND"); etch exits ) {ek(f,0.SEEK_END); fsize-felllp); feek( ff, SEEK_SET); str—(char*)mallos(ize+1);ny while) 7 { chfget(ip) it fot) ) break; stofi-t-oh; ) sufi0 ‘anna fseok(fp,0,SEEK_SET); -eetch0; ) annoeRE comune finclude
inelude
finclude
incladecstringh> snug void mang) ‘ ILE “ip; char eh; char fname{200}; char str; prin{("nENTER FILE NAME"); getdiname p-fopen(iname,"6"), if{{p-NULL) ‘in\WFILE NOT FOUND", fize=Melllp) fseck( ip 0,SEEK_SET); ‘ste=(char® malloc(size+1); sonny while(1) { ch=feetttp) MC fom) ) break: siti }-oh; ) sxi)=10; ont feek((p 0,SEEK_ SET); Harp chick); strevist), Sprint 4s"), felose(): ee isnninE CODEC finelude
Hinelude
Fineludecallos b> ‘oid streode(char “ptr in code) t forttptnptr}) if{epte!~\n' pte) Spart=vode; ) ee void maind) t FILE “ip; ‘har eh cleser); printi("\WENTER FILENAME: gets fname); {p=fopen(fname,"r="); iflfp--NULL) fi prini"'NFILE NOT FOUND"; sei: ) print("AFOR ENCODE ENTER print("FOR DECODE ENTER sanf("%4d" lag); :ftdag—1) eode=40: {eek fp.,SEEK. END): fsize-tellip) fieek( (p0,SEEK_SET); str(eh* plo ize 1), sma while){ chgeto(f; if{feot(p)) break: stoi Jee; ) stil; untae fek( Ip 0,SEEK_SET), streode(tr cod Sprint," felose(): eee NINIWISSSTRING AFTER Il ‘ineludecatdio b> ineludesprocess > void main) t har fname{ 100}; bar eh; FILE *sfp.p; har {100}; intnl=O.aum; clrserQ; pring ("WENTER FILE NAME:"); etna); } print{(MENTER STR setts prinf("WENTER NUM 3"), +9")! “etespm\"ye8 LUp=fopen(‘tempoPMitemp 1x0"); iff=-NULL) { prini"'sUNBALE..."; exit); ) Jee ‘prints; while!) ch fet): if feiitp)) break Sprint, "%e"ch), iffet=="n) . ales iffal—num) { ‘print. leo; 3 } Fprintp. "ats sti, anno felosesip) felose(); sfp-fopen(":\tempéPM \wemp.ixt"); {fp=fopen( Tname,"w); inausonni while) t a): chfgettsp ill feoftsfp)) 4 break; remove("esempsPMi\temp.txt"); seteh() 3 ‘1EREMOVE MULTIPLE SAPARATORS FROM FILE Fineludestdios> tinciude-process b> void main) { ILE *5fptp; print" ENTER FILE NAME:" sets fname); slp=fopen name," t printi("MFILE NOT FOUND"), fetch) exit); ) ‘hfp-fopen("tempxt,"W "lives Ye te6PM tfp-fopen(e\temyoPMtempt"), ill-=NULL)‘ print('QUNABLE,..."9 exit); } os while(t) { chfyote(stp)s iff feofsfp) ) break; ittlag—0) forint, "%6e'.ch); ‘phen aged: ease } annem felosestp): felose(tD); sfp-fopen("e:Memp6PMi\emp 0x"); tlp=fopen(iname, "Ww"; annie i feofsfp)) break; frit, "%e"eh), ) ‘nay felosestp)s lose) 4 geteh0; remove(“ei\tempoPMivempsat"), Sana i includecstdio.h> includesprocess b> define Pi "e\Memp6pmiintr.mp3" define F2 "e\Mempépmiinte2 mp3" fdefine F3"esvempéprine3. mp3" define PS "eMempépntré mp3" void mang) t FILE *sfp, tp; : ‘char ch; | ‘char fname(200); ‘char tfames(4](200}=(F1,F2,F3,F4}; | iati-os Jong int fizgnb-o; cles) print ("ENTER FILE NAME:"; | set(fbame); Spefopen(Eame-"; ifelp-NULL) { ‘print("\FILE NOT FOUND"); etch; exit(); } {eek(sp,0.SEEK_ END); fsize-fellp); feek(#p,0.SEEK_SET); tip-fopentfnames{0], wb"); if{p=NULL) { print("WUNABLE exit); ) nunca while) t ch fgete(stp); iff feostp)) break: frimttlp,"%c",eh);, abt; if aan elt) losetip); lp fapen( names +4], "wb") nb=0;, i } onc ‘lose(sip), felose(t etch: ) unui ADD.Comminsty finclude
incladesprocess > fidefine FI "e\tempspmntel mp define F2 "e\itempsponne2 mp3define F3 "e\emp6pm\nte. mp3" ‘define FS "e\empépm\ntes. mp3" ‘oid main() { Pe sus Charo tha iame(200) har shames 200)... iat prfCENTER FILE NAME eltame) {prope MeeeNULD) be i prinf"wnFILE NOT CREATED"); etch; exi(): ’ snare foxfindickit+) { sfp=fopen(stnamesi)."b" while(1) { hetgete(stp)s if feof) ) breaks Spine." } felose(sip) anc Ilose(ttp; etch; MIQirEMMP DATA BASEL include-stdio.> Hineludeprocess > typeset struct { ivi: char name(36]: int sal: EMP: FILE “ip; int ne EMP &: char 6; void main() { int fag; void createemps(; void modifyemps0; void displayemps() int noofemps); eleser0s while) t print"\nFOR CREATE EMPS ENTER printQ"'nFOR MODIFY EMPS ENTER PeiroR DISPLAY FMS ENTER 3° printi"'MFOR NO OF EMPS ENTER print\MFOR EXIT ENTER ANY...) scanf("%d, flag); sviteh(fag) + ‘ case Lereateempa() breaks case 2:modifyemps0); break; case Sdisplayemps0 break; case print("WNO OF EMPS~ %6":nookemps(); break; defauliex END LOOP. } END MAIN im aoofemps0) fiy-Fopent*es\empdat, illtp==NULL) retum 0; fseek((p.0,SEEK_END); nne-fell fpysizcoHtEMP): felose(ph return ne; END NOOF EMPS void ereaeemps() { ne=noofempst): fp=fopen(“:\emp datprini('n UNABLE TO CREATE DATABASE} etch; exit); ‘ i eid-tene; prin" printf \WENTER NAME fush ets(ename): printiENTER SAL, scant sal); fwrite(&e, sizeof); md"eid) print"\nDO U WANT TO ENTER ONE MORE YIN 2"; ushallds seanf("%e, ec), Jovhilele-— yes felose(fp): )} END CREATE EMS ‘oid displayemps() i rne-noofempst) if{ne=0) { printi"\wNO DATA"; ) fp-fopen("eemp dat, princi! ww} fon(i=lic=ner) i fread(@e.sizeot(e). tp): rinf( "ID =942d SAL=%654 NAME=%610s "eide.sal.e-name) } rim felose(fp); } END DISPLAY EMP void modityemps() i ini rne=noofemps(); ilfne=0) { primt"aNO DATA"): ) prin" OF EMPS= %.ne), print 'n WHICH EMP RECORD U WANT ‘TO MODIEY"}, print"inNTE 1D"); scanf("%4d", id); tect) rint@aINVALID ) Ip-fopent"eiemp dat, "i6+"); feeek{ Hp (+1) *sizeoffEMP) SEEK SET); fread( fe sizeofle) L695 fiek(fp(d-1)*sizeoftEMP) SEEK, SET); rint("nID=942d SAL=%Sd NAME-%6I0s "e.de.sa.e.ame) ‘prini("'MENTER NEW NAME"), fushalo; setsesname) rint'nENTER NEW SAL:"); nia” esa; fwrite(&esizeole) 1); felose(), } (END FOR MOD Inn ARG comme void loin ergata) prini(\MNO OF ARGLMENTS=¥d" arg); printf("\aTOTAL ARGUMENTS: Fovti=Oicargcii+*) prinf("%6d. ARGUMENT-94s"¢anevil)s etch); } ‘gtihCORY CMD... finchude
#include
void msi eset FILE "spt; char chi itfarge) fi prinf("\MARGUMENTS MISSING? exit); } iarge>3) ‘ prin{"'nTOOMANY ARGUMENTS"); exi(2) )print(\aSF FILE NOT FOUND") exit); ) {pfopentangr(2] "2" iffy! -NULL) { prins( "TF FILE ALREADY AVILABLE..") printf... OVERWRITE(YIN). MushaliQ ae felose(tp), fopentargv{2|"wo"}s > iflp==NULL) 1 print("\MUNABLE, exits), ) nenoncn while) t ef itteotip) ) break; frinlpe"ch)s ) nnn Felose(stpy felose(ip) printf"40K OK OK"); ) ‘ynymrDASPLAN cont ‘ineludeeseiodk> include-dosh> Finelude
‘void main(int argchar*arev) ‘ FILE "ip: char ch iflarge-2) i print"\REQUIRED ARGUMENTS ARE MISSING; exi( 1): i Mange=2) ‘ prins('nTOOMANY ARGUMENTS"); exit); ) onan pentarev{ if{fp—NULL) exit); while) { chfaeto(t; iff feof) ) break; printi"%e",ch), Meh") } sane delay(5000); ) ‘nnnoro mao ean HiitiDIRMOD INS STR IN ALL. FILES. include
include
includesstring h> macnn ‘void framepath(char *dname,char *aame,char * fname) fi strepy(fhame,dname) for(:names fname); for(*fname!="Vsfname-); stcpy(Goamet1,name); } oon ‘oid main() ‘ struct Ik bk; int done; im counter0; char dimame[200}; har fame{ 200}; FILE *sp.*tp; char 7200}; it lsum: char eh; clrser), print" nENTER DIR NAME"); sets(rname’: mrinENTER STR 2 frushalo gets):printfl"'nENTER NUM scani("%4d" enum) ‘rint(Direoory isting of Ye" dumame), done finds(dimame fe Mb1,0); while (done) {ramepath(dimame,(fblkfF_name, fname), printed. 96s'++counter fname); nec alo; sfp-fopen(faame"); \ip-fopenttemp."',"¥") stim Sprint, "bn" st), while) { chnfgete(sfp); it{feot(stp)) ( Sprint. sta"); al-o; ) ) Aint, ns" st) Anant {alose(stp); lose); sfprfopen("temp.xt"); tip=fopentfname,"W"}; snc while) i chofgetlofp)s flose(ip): remover"temp tx"); cies done ~findnext (lk; ) aad- C programming - C++ programming #202, MAHENDRA RESIDENCY Contact Details 3RD BUILDING FROM ADITYA TRADE CENTER 66622789, 66623709 AMEERPET,HYD6! 9704177700,7032300891
You might also like
Cs Imp25
PDF
No ratings yet
Cs Imp25
29 pages
C Programming - Unit 1 Final
PDF
No ratings yet
C Programming - Unit 1 Final
75 pages
C Language
PDF
No ratings yet
C Language
68 pages
C Programming Note by Rajesh Parajuli
PDF
No ratings yet
C Programming Note by Rajesh Parajuli
83 pages
Unit 1: Introduction To Programming in C
PDF
No ratings yet
Unit 1: Introduction To Programming in C
428 pages
PC Lecture Notes
PDF
No ratings yet
PC Lecture Notes
165 pages
Ccs 2101 Introduction To Programming in C Notes 1 3 1
PDF
No ratings yet
Ccs 2101 Introduction To Programming in C Notes 1 3 1
27 pages
PPS Material-2023
PDF
No ratings yet
PPS Material-2023
92 pages
Complete C Notes
PDF
No ratings yet
Complete C Notes
142 pages
Fundamental of C Programming (PPS)
PDF
No ratings yet
Fundamental of C Programming (PPS)
8 pages
Programming1 (SEM1)
PDF
No ratings yet
Programming1 (SEM1)
49 pages
I BSC Sem2 Paper2 C Prog 2019 20
PDF
No ratings yet
I BSC Sem2 Paper2 C Prog 2019 20
110 pages
1 - Introduction To C Programming
PDF
No ratings yet
1 - Introduction To C Programming
76 pages
Flowchart&Pseudo Codes
PDF
No ratings yet
Flowchart&Pseudo Codes
14 pages
Structure Programming: ICT-1105 Information and Communication Technology
PDF
No ratings yet
Structure Programming: ICT-1105 Information and Communication Technology
32 pages
C Programming Notes
PDF
100% (1)
C Programming Notes
156 pages
Organization of A Computer: Task Is To Repeatedly Perform Fetch-Decode-Execute Cycle. It Consists of
PDF
No ratings yet
Organization of A Computer: Task Is To Repeatedly Perform Fetch-Decode-Execute Cycle. It Consists of
16 pages
C by DR P.K.Bhatt
PDF
No ratings yet
C by DR P.K.Bhatt
46 pages
Detailed C Programming Notes For BCA, MCA
PDF
No ratings yet
Detailed C Programming Notes For BCA, MCA
260 pages
Session1 - 3 - Introduction To Algorithm I - Final
PDF
No ratings yet
Session1 - 3 - Introduction To Algorithm I - Final
101 pages
IP Unit 1
PDF
No ratings yet
IP Unit 1
35 pages
VU-BCA-SEM-1 UNIT 1 Introduction of C
PDF
No ratings yet
VU-BCA-SEM-1 UNIT 1 Introduction of C
19 pages
C Tutorial Day 1
PDF
No ratings yet
C Tutorial Day 1
12 pages
ComputerProgramming143 CheatSheets
PDF
No ratings yet
ComputerProgramming143 CheatSheets
4 pages
BCA I Year C Notes
PDF
No ratings yet
BCA I Year C Notes
36 pages
Psuc Unit - 1
PDF
No ratings yet
Psuc Unit - 1
82 pages
24000
PDF
100% (1)
24000
772 pages
Share Dorig - Princess - Ashlie COMPUTER PRIGRAMMING LESSON TWO
PDF
No ratings yet
Share Dorig - Princess - Ashlie COMPUTER PRIGRAMMING LESSON TWO
13 pages
Errors+Flow Charts
PDF
No ratings yet
Errors+Flow Charts
20 pages
Basics of C
PDF
No ratings yet
Basics of C
63 pages
Computer Programming
PDF
No ratings yet
Computer Programming
53 pages
Turboc Notes Compress
PDF
No ratings yet
Turboc Notes Compress
102 pages
Computer Programming
PDF
No ratings yet
Computer Programming
9 pages
Structured Programming Language ICT 1103: Professor Dr. Mohammad Abu Yousuf
PDF
No ratings yet
Structured Programming Language ICT 1103: Professor Dr. Mohammad Abu Yousuf
50 pages
Unit 1
PDF
No ratings yet
Unit 1
68 pages
Module 1
PDF
No ratings yet
Module 1
54 pages
Edited - Cfap - P.L.
PDF
No ratings yet
Edited - Cfap - P.L.
118 pages
CPDS UNIT I Final
PDF
No ratings yet
CPDS UNIT I Final
110 pages
Unit 1 C Notes
PDF
No ratings yet
Unit 1 C Notes
43 pages
CS101 Lecture 02 - Introduction To Computers & Programming Part 2
PDF
No ratings yet
CS101 Lecture 02 - Introduction To Computers & Programming Part 2
52 pages
Chapter 1 Problem Solving and Introduction To C
PDF
No ratings yet
Chapter 1 Problem Solving and Introduction To C
21 pages
ch2 Lec1
PDF
No ratings yet
ch2 Lec1
62 pages
Cat1 C
PDF
No ratings yet
Cat1 C
84 pages
TurboC Notes
PDF
No ratings yet
TurboC Notes
102 pages
3 Algorithm
PDF
No ratings yet
3 Algorithm
33 pages
Lec 1 Overview of Computer Systems
PDF
No ratings yet
Lec 1 Overview of Computer Systems
31 pages
CSC 1113 LMS L1
PDF
No ratings yet
CSC 1113 LMS L1
5 pages
Maths Ukg
PDF
82% (84)
Maths Ukg
6 pages
Computer Programming PDF
PDF
No ratings yet
Computer Programming PDF
260 pages
C Programming Part 2
PDF
No ratings yet
C Programming Part 2
10 pages
PSP - Module 1
PDF
No ratings yet
PSP - Module 1
24 pages
Chapter 4
PDF
No ratings yet
Chapter 4
147 pages
Kala Bhairava Brahma Kavacham
PDF
0% (2)
Kala Bhairava Brahma Kavacham
2 pages
1.1.3 Algorithm
PDF
No ratings yet
1.1.3 Algorithm
33 pages
Fundamentals of C++ Programming: Hochiminh University of Technology Computer Science and Engineering - (CO1011)
PDF
No ratings yet
Fundamentals of C++ Programming: Hochiminh University of Technology Computer Science and Engineering - (CO1011)
34 pages
IT - Som Værktøj: Bent Thomsen Institut For Datalogi Aalborg Universitet
PDF
No ratings yet
IT - Som Værktøj: Bent Thomsen Institut For Datalogi Aalborg Universitet
46 pages
Chapter2 1
PDF
No ratings yet
Chapter2 1
26 pages
Note 1438938683
PDF
No ratings yet
Note 1438938683
38 pages
1b) SMA 2175 Introduction To Programming in C Notes - 1-3
PDF
No ratings yet
1b) SMA 2175 Introduction To Programming in C Notes - 1-3
26 pages
Unit 1
PDF
No ratings yet
Unit 1
61 pages
1 An Overview of C
PDF
No ratings yet
1 An Overview of C
36 pages
English - Unit.3-What Is A Tree
PDF
No ratings yet
English - Unit.3-What Is A Tree
19 pages
ACT Fibernet - D-Link DIR 816 Basic Steps
PDF
No ratings yet
ACT Fibernet - D-Link DIR 816 Basic Steps
13 pages
Exam Paper Maths
PDF
No ratings yet
Exam Paper Maths
4 pages
Written Examination Syllabus For The Post of Trained Graduate Teacher in Residential Educational Institutions Societies
PDF
No ratings yet
Written Examination Syllabus For The Post of Trained Graduate Teacher in Residential Educational Institutions Societies
29 pages
Maths - Kowning Numbers
PDF
No ratings yet
Maths - Kowning Numbers
23 pages
How To Configure Cisco Switches - A Step by Step Guide - Comparitech
PDF
No ratings yet
How To Configure Cisco Switches - A Step by Step Guide - Comparitech
12 pages
WG-2: Election Planning, Management, Results & Constitution of The House
PDF
No ratings yet
WG-2: Election Planning, Management, Results & Constitution of The House
13 pages
Class: 4 Subject: Mathematics 4. Knowing Numbers
PDF
No ratings yet
Class: 4 Subject: Mathematics 4. Knowing Numbers
4 pages
Pointer.: Company Information & POINTER Information
PDF
No ratings yet
Pointer.: Company Information & POINTER Information
5 pages
LR - No.H1/7554/2015 Dated: - 12-2015
PDF
No ratings yet
LR - No.H1/7554/2015 Dated: - 12-2015
1 page
The Activity of Children: Confidential 17
PDF
No ratings yet
The Activity of Children: Confidential 17
1 page
The Activity of Children: Confidential 100
PDF
No ratings yet
The Activity of Children: Confidential 100
1 page
The Activity of Children: Confidential 99
PDF
No ratings yet
The Activity of Children: Confidential 99
1 page