Computer Language. It is a systematical code for communication between System and user. This is in two categories.

Size: px
Start display at page:

Download "Computer Language. It is a systematical code for communication between System and user. This is in two categories."

Transcription

1 ComputerWares There are 3 types of Computer wares. 1. Humanware: The person, who can use the system, is called 'Human Ware ". He is also called as "User". Users are in two types: i. Programmer: The person, who can develop programs, is called "Programmer". ii. End User: The person, who can use the software (developed programs), is called "End User". 2.Hardware : The physical components (devices) of a system are called "Hardware". Monitor, CPU, Keyboard, Mouse etc. 3. Software : Def: Set of related programs is called Software". Software is further divided into two types: i. System software: System software does not perform any task. It can manage the operating system in local machine. Operating System: DOS, Windows etc. ii. Application software: It is performing any task or solving a particular problem. This is further divided into two types: a. Packages: Collection related Applications are called "Packages". b. Languages: It is a systematical code for communication between two persons. Computer Language It is a systematical code for communication between System and user. This is in two categories. i. Low Level Language: Machine dependable language are called "Low level languages". This is further divided into two types. a. Machine language: Machine understandable language is called "Machine language". It is understandable by BINARY LANGUAGE. It is in the form of 0's and 1's. Draw back: User does not understandable that code. b. Assembly language. : It is a code language. It has some

2 codes for performing specific operations. This is better than machine language. ADD, SUB, MUL, DIV, ABS, FACT etc. Draw back: some codes and its operations are not easily identified by the user. ii. High Level Language : User understandable language is called "High level language". Because, it is in the form of English. Translators: Assembler: It is translating software. It translates assembly code to binary and vice versa. Compiler / Interpreter: Both are translating soft wares. Those can translate high level language to binary language and vice versa. Compiler can process a whole file at a time and it provides.exe files. But, Interpreter can process a file line-by-line only. It does not provide.exe files. This is the main difference between them. Algorithm Def: Algorithm means a step-by-step procedure for solving a particular problem. Algorithm is designed in two ways. 1. Pseudo code: It is a dummy code for solving a problem. It is designed in simple English language. 2. Flow chart : It is the graphical representation of solving a problem. Introduction to C C is a programming language. That was designed by a man named "DENNISE RITCHIE" at AT & T Bell Labs in USA in The C programming language is a powerful programming language. Because, it is Middle level language. That means, it is machine dependable and program dependable. So, it is Middle level. This is the Mother of All programming languages. Learning Steps in 'C' : Character Set Word Instruction Program Software

3 Character Set : Def: All allowable symbols in this language are called "Character set". The following characters are used in this language. Alphabets a...z A...Z Digits 0, Special Symbols + - * / % < > =! ' " : ;.,? \ _ ( ) [ ] # $ ^ & White spaces Word: Def: Group of characters is called a 'Word'. There are 3 types of words in C. i. Keyword ii. Variables and / or Identifiers iii. Constants i. Keywords : - Keywords are the words. Those have a specific meaning defined in C compiler. So, those are called as 'Reserved words'. - These are Pre-defined words. - There are basically 32 keywords in C. int switch while struct long case for union short default far enum float break near typedef double goto auto void char continue regitster singed if return extern unsigned else do static const ii. Variable : Meaning: The quantity that can change their value during program execution. Def: It is a user-defined name. That is given to the memory location, where the quantity is stored. x =35 Here, the 35 is stored in the location (65000) of memory. A name given to that location is 'x'. Here, x is called variable name. Rules for constructing a variable name : 1. The name should not matched with Keyword 2. The maximum length of a variable name is 8 chars and some

4 compiler can allows up to 41 chars. 3. The first char. must be an Alphabet. 4. Rest of the chars. may be Alphabets / Digits / (_) are allowed only. 5. Spaces or other special symbols are not allowed. VALID INVALID data auto var25 var 25 interest data,35 emp_code $var1 hello_5 _stdno DATA AUTO etc. Operators Def: - Special symbol. - That can perform a specific operation without changing their meaning. - All operators are special characters. But, all special characters are not operators. Operators are classified into 3 categories.? Unary Operators: Single operand with an operator is called Unary Operators. Ex. Increment and Decrement operators.? Binary Operators: Two operands with an operator are called Binary Operators. Ex. Arithmetic, Logical, Relational etc.? Ternary Operators: Three expressions with an operator are called Ternary operators. Ex. Ternary operators. There are 8 Types of operators. i. Arithmetic operators : The special characters +, -, *, / and % can performing their corresponding arithmetic operations are called 'Arithmetic Operators'. ii. Relational operators : The special characters >, <, >=, <=, == and!= are called Relational operators. These operators can be used for designing a condition only. Note: condition: Any two quantities are combined with a relational operator that is called

5 a condition. Any condition can returns either TRUE or FALSE only. But, not both at a time. syn: ( Q1 relnl.opr. Q2 ) 3. Logical operators : The special characters &&, and! are called 'Logical operators'. Those can perform their corresponding actions. These operators can be used for joining more than one condition. It returns either TRUE or FALSE only. But, not both. 4. Assignment operator : The special character '=' is called an Assignment operator. That means the right quantity is assigned to left side variable. syn: var = constant / var / exprn ; x = 3 // constant assignment y = x // variable assignment z = x + 10 * y // expression assignment Note : Expression means the combination of variables and / or constants with arithmetic operators. This is also called as an operand. 5. Conditional Operators [ Ternary Operators] : The symbols? and : are called Conditional operators. Those are also called as Ternary operators. A statement formed with these two operators is called Conditional operator statement. syn: expr1? expr2 : expr3 ; Here, expr1 is a condition. expr2 is a true statement and expr3 is a false statement. Note: The conditional operator statement can executes only one statement (either TRUE or FALSE statement) 6. Increment and / or Decrement operators : The symbols ++ and -- are called Increment and Decrement operators. These two operators are applied to variables only. Increment : It means 1 is added to the previous value of that variable. This operator is placed in two ways. 1. Pre-increment operator: Before assigning to a variable its value will be incremented

6 by 1. syn. ++ var ; ==> var = var + 1; x = 5 y = ++x x = 6 and y = 6 2. Post-increment operator : After assigning to a variable, its value will be incremented by 1. syn. var ++ ; ==> var = var + 1; x = 5 y = x ++ x = 6 and y = 5 Decrement : It means 1 is deducting from the previous value of that var. This operator is placed in two ways. 1. Pre-decrement operator : Before assigning to a variable its value will be decremented by 1. syn. -- var ; ==> var = var - 1; x = 5 y = -- x x = 4 and y = 4 2. Post-decrement operator: After assigning to a variable, its value will be decremented by 1. syn. var --; ==> var = var - 1; x = 5 y = x x = 4 and y = 5 7. Bitwise operators: The following operators can be used for performing their actions on bit values only. Operator Meaning & Bitwise AND Bitwise OR ^ Exclusive OR (XOR) ~ Complement >> Right shift << Left shift >>> Right shift fill with zero 8. Special Operators : The following special chars can be used for specific purposes in the

7 program. Operator Meaning # Pre-processor. data accessing operator -> '' (pointer ), separator sizeof to find size of a variable Tokens Def: The smallest individual unit in a program is called Token. C Tokens :- 1. Character Set 2. Key Words 3. Variables and Identifiers 4. Constants 5. Operators 6. Data Types Note: Identifiers: Identifiers refer to the names of variables, functions, arrays, classes etc. Instructions: Def: Collection of words has returns a complete meaning and ends with a semicolon (;) is called an Instruction. Types of Instructions 1. Type declaration Instructions: Any variable is used in a program that must be declaring its data type before using it. syn: datatype var1, var2,...; int a; float data; char grade; 2. I/O Instructions: To read data from key board (std. input device) using a statement. That is called "Input instruction". To display the information on the monitor (std. output device) using a statement. That is called "OutputInstruction".

8 Syn: scanf ( ) ; This is the standard input instruction in C. printf ( ) ; This is the standard output Instruction in C. 3. Arithmetic instructions: Def: These instructions can perform Arithmetic calculations. c = a+b; gross = basic + hra +da; etc. 4. Control instructions: Def: To control the flow of execution of the program using certain statements are called "Conrol Instructions ". if statement, looping statements etc. Program Def: Set of instructions can solve a particular problem or performing a specific task is called a Program. General form of C Program: [Comment lines] including statements [defining statements] void main() [variable declaration section ; ] [clear screen section ; ] [input / output section ; ] [processing section ; ] [getch() ; ] [functionction definitions] comment lines : Def: Unreadable code used in a program that is called a comment. - It describes about the program. - It can be used for Identification only. - In this statement, we can use two types of symbols /* starting comment

9 */ ending comment Any code in between these two symbols. That's called a comment. - It can be used any where in the program. - It can be used in any no. of times in a program. - Nested comments are not allowed. - Comments are splitted more than one line. 1. /* this is single line comment */ 2. /* this is multiple line comment */ Including statements : Def: To down load any header files using a statement. That is called "Including statement". Header file: - It is a pre-defined program. - It contains function (Sub programs), variables and constants etc. syn: # include <headerfile> Here, the symbol '#' reps. pre-processor. The word "include" is a system code. #include <stdio.h> Here, stdio.h is the name of header file. If we can download this header file, we can use the pre-defined functions and constants defined in that header file in our program. - This statement does not ends with semicolon ( ;). - It can be placed at the beginning of the program only. Defining statements: Def: To define a constant value to the var. That value does not modify through out program. - Generally it can be placed at the beginning of the program. It can be used in body of the program also. - This statement is called a 'Macro definition' or simply a 'Macro'. syn. #define template expansion Here, # pre-processor symbol define system code

10 #define PI #define P printf #define M main( ) etc. Note: Generally Templates can be used as Uppercase letters. Easy to identify the templates in a program. main() : This is a user-defined function. Any function represents as follows, name( ) That can do some thing in a program. main () Here, the word main is followed by a pair of parentheses (). That represents a function. - Each and Every C program must start its execution from this point only. - This is defined by programmer only. so, it is user - defined function. - Any function can return a value. but, main() function. does not return any value. Because, it is preceded by the keyword 'void '. Here, void is the one of the keyword. Block : More than one instruction placed in a pair of braces. That represents a block of code. void main ( ) executable statements ; ; ; variable declaration section : - This is the first section every function definition. - Any var. used in the function / program. That can be declared it's data type before using it. Syn. Datatype var1, var2, var3,... ; int x, data, num ; Here, the words 'x', 'data' and 'num' are vars. of same data type int. Each variable name separated by a comma and variable names and data type separated by a space, ends with a semicolon.

11 clear screen section : - This is the second section every function definition. - In this section, we can use a library function. i.e. clrscr () ; It can clear the screen. That means, erases the previous output on the screen. It displays empty screen. - This function is defined in the header file, ' conio.h '. conio.h console input output header file. Input/output section : In this section, we can use input instructions and output instructions. o Input instruction : Reading any type of data from KB (Std input device) using an instruction is called 'Input instruction '. scanf ( ) ; o Output instruction : Displaying any type of data on the Monitor (Std output device) using an instruction is called 'Output instruction '. printf ( ) ; Here, scanf() and printf() are standard input and output instructions used in C language. These two are library functions and defined in the header file 'stdio.h'. processing section : In this section, we can use arithmetic instructions and control instructions etc. This is the body of the program. //this is arithmetic instruction c = a + b ; // this is control instruction if (cond) ; getch() : - This is library function. It reads a single character. But, does not display on the monitor. - Generally it can be used as the last statement in every C program. It can also use any where in the program except declaration section. - It is defined in the header file, 'conio.h'. - This function belongs to console input function. Rules for constructing a c program :

12 There are some rules for constructing a C program. 1. It can allow only lower case letters. 2. It is case sensitive language that means, lower case and upper case are distinct. Upper case letters can also use in a program at some places only. (Variables or constants etc) 3. Each word is separated by a space and/ or a comma only. 4. Each instruction ends with semicolon ( ; )only. printf (): - It is a Library function. That is defined in the header file 'stdio.h'. - It can display any type of messages on the monitor only. syn: 1. printf("msg"); 2. printf("formatting string ", List of variables); Here, formatting string could be, messages + conversion characters It must be placed in double quotes only. List of variables Each variable name in the statement separated by a comma and formatting string and list of variables separated by a comma. Eg: 1. printf("welcome to C students "); 2. printf(" Roll No = %d Name = %s Average = %f ", no, name, per ); scanf() : - It is also a Library function like printf(). It is defined in the header file 'stdio.h'. - It can read any type of data from KB (Std. input device) only. - It is the standard input function in C language. syn : scanf (" formatting chars ", list of vars); Here, each variable name must be preceded by a special symbol (&). '&' reps. 'Address of a variable.' Eg: /* reading any two integer values from KB */ scanf("%d%d", &x1, &x2); /* reading emp code, name and salary */ scanf("%d%s%f ", &code, &name, &salary); Note: It does not allowed any spe. sym or msgs. gotoxy() :

13 - It is a pre-defined function. It is defined in the header file conio.h. - It moves the control to the specific location on the monitor. syn: gotoxy(col, row); Here, col 1-80 row 1-25 gotoxy(40,12); Control Statements Def: To control the flow of sequence of execution of a program using certain statements are called "Control Statements". there are 3 categories of control statements. 1. Branching statements : A block of code will be executed based on given criteria (condition). Eg: 1. Ternary operator statement (conditional Operator Statement) 2. if statements 3. switch statement (multiple block statement) 2. Un-conditional statements : The control will moves from one location to another location without checking any condition in a program. 1. goto statement 2. break " 3. continue " 4. return " 3.Looping (Iterative) statements : these can be used for repeating a block of code in specified no. of times or un till the condition returns false. 1. while loop 2. do-while loop 3. for loop Advantages : - To avoid the re-writing of the same code - To reduce the length of a program - Executing time is low - Save memory space - Debugging is easy. condition: It is an expression. That is formed with relational operators. It returns

14 either TRUE or FALSE only. But, not both at a time. Syn: ( Q1 Relnl.opr Q2 ) conditional operator statement: The statement formed with conditional operators (ternary operators) is called "conditional operator statement". syn: expr1? expr2 : expr3 ; Here, expre1 is a condition, expr2 is a true statement and expr3 is a false statement. Note : It executes single statement only. if statement : Def: This is also conditional statement like ternary operator statement. But, it can executes a block of code when a cond. returns either TRUE or FALSE. There are 4 types of if statements. 1. Simple if : syn: if (cond.) //true statements 2. if- else statement : syn: if (cond.) else // true statements //false statements 3. nested - if statement : An if is placed in another if statement. That is called 'Nested - if '. syn: if (cond1) // outer true statements if (cond2) //inner true statements else

15 else // inner flase statements //outer false statements 4. Ladder if statement : syn: if (cond1) else if (cond2) else // 1 true statements // 2 true statements if (cond3) // 3 true statements else // false statements switch stt. : - It is similar to if - statement. - This is multiple blocks of statement. - It is also a selection statement. - Generally, it can used for Menu driven programs only. Syn: switch( var ) /*beginning of the switch */ case const1 : ; ; break; case const2 : ;

16 ; break; case const3 : ; ; break; default : ; /* end of switch */ break statement : - It is an un-conditional control statement. - It can be used as the last statement in every case in switch statement. But, in default case need not necessary. Because, default case is the last case in switch statement. So, control will be comes out from the switch automatically. - Generally, it can be used in looping statements also. - break preceded by an if statement in looping statements. Syn: break ; goto statement: - It is the un-conditional control statement. - It can transfer the control from one location to another location in the same program without checking any condition. - The word goto is the one of the key word. syn: goto label ; // declaration or/and calling a label label : executable statements ; When the goto statement is executed, control transfers to the definition of the label. - Any no. of gotos can be used in a program. - But, each label must be defined uniquely. - A goto statement can use any no. of times in a program. Looping (Iterative) statements : these can be used for repeating a block of code in specified no. of times or un till the condition returns false.

17 1. while loop 2. do-while loop 3. for loop Advantages : - To avoid the re-writing of the same code - To reduce the length of a program - Executing time is low - Save memory space - Easy to debug While: - It is a pre-checking looping statement. That means, initially checks the given condition. If it returns TRUE then the block of code is executed. That the block of code is executed until condition returns FALSE. If it returns FALSE then exit from the loop. Syn: initialization ; while (cond) ; ; updatable statements; do-while: - It is post-checking looping statement. - That means, after executing the block of code then the condition will be checked. If it returns TRUE then only repeat the code otherwise control transfers to the next statement of that loop. Syn: Initialization; do ; ; updatable statement; while(cond) ; Note: It can execute the block of code at least once. This is the main difference between do-while and while looping statements. for :

18 - It is also a pre-checking looping statement like while statement. That means, initially checks the given condition. If it returns TRUE then the block of code is executed until condition returns FALSE. If it returns FALSE then exit from the loop. - It works as same as while loop. Syn: for ( initialization ; condition ; updatable statement ) // body of loop - The main difference is the statements (Initialization, condition and updatable) are in the same line in for loop. CHARACTER TYPE FUNCTIONCTIONS The following functions are defined in the header file "ctype.h". These functions are belongs to character. Function. isdigit() isalpha() islower() isupper() isalnum() isspace() tolower() toupper() Meaning checks the character is digit checks the character is alphabet checks the character is lower case checks the character is upper case checks the character is alpha numeric checks the character is space converts to lower case character converts to upper case character Arrays Def : Set of similar data elements has shared a common name called 'an Array'. Representation: varname [ size ] Here, size must be a +ve int only. size represent maximum size of an array. Types of Arrays: There are two types of arrays. Those are, i. Single Dimensional Array [1 - D array] ii. Multi Dimensional Array [n - D array] Single dimensional array : A variable name followed by a single pair of square brackets ([ ]) called 'Single dimensional array'. syn.

19 Datatype varname [size]; int a[5]; Here, 'a' is a variable name and 5 is the maximum size of that array. That means 'a' can holds 5 integer values. If a variable is declared as int data type that array is called 'integer array'. Similarly, 'float array'. But character array is called a 'string'. Notes: 1. Array elements are stored in sequential order in the memory. 2. Each & every array first element is stored in 0 th position and its last element is stored in (size -1) th position. 3. In single dimensional array, all elements are stored in linear order. That means, either in row wise or column wise only. Multi dimensional array : A variable name followed by more than one pair of square brackets ([ ]) called 'Multi dimensional array'. syn. Datatype varname [size1] [size2] [size3]...[size n]; 2 - D Array : A variable name followed by two pair of square brackets ([ ]) called '2 - D array'. syn: Datatype varname[size1][size2]; Here, size1 max. rows size2 max. columns Note: 2 -D array elements are stored in matrix format. That means, rows and columns wise. int a[3][2]; Here, 3 --> rows and 2 --> columns. String Handling Functionctions There are some pre-defined functions on strings. Those are defined in the header file string.h. Function. strlen() strcpy() strcat() strrev() Purpose calculates length of a string copies a string to another string concatenates two strings reversed strings of a string

20 strcmp() strlwr() strupr() strstr() compare two strings converts into lower case converts into upper case substring of the given string Functionctions Meaning: 'Do something' in a program. Def: A self contained block of code performing a specific job of some kind. That is called "Function". Repesentation: Any name followed by a pair parenthesis. syn. functionname ( ) There are 2 types of functionctions. 1. Library functionctions: Pre-defined functions. are called 'Library functions'. These are defined in the header files. printf () scanf( ) clrscr() getch() etc. 2. User-defined functionctions: These functions. are defined by programmer only. prime() display() getdata() etc. Notes: - main() is a function. It has collection of function. Each and every C program must start its execution from this function. only. - Any no. of functions can be used in a program. - A function can be used any no. of times in a program. - Any function can return a value with return statement. Here, return is a key word. syn. return (var / const. / exprn ) ; - It can be used as the last statement in every definition. - The void function does not return any value. The word void is also a keyword. - A function can be called from another one. Arguments: There are 3 types of arguments. 1. Actual arguments :

21 The vars., which are passing thru a function. called 'Actual arguments'. Syn: functionname (argslist) ; add(a, b); Here, the vars. 'a' and 'b' are called actual args. 2. Formal arguments: The variables, which are declared in a pair of parentheses at the function definition called 'Formal arguments'. syn. returntype functionname(args list) // body of the function. void add ( int x, int y) // body Here, the vars. 'x' and 'y' are called formal arguments. 3. Local variables : The variables, which are declared in a pair of braces at the function definition called "Local variables ". syn. returntype functionname(args list) declaring vars. ; // body of the function. void add ( int x, int y) int z; // local var. // body of the function. Rules for calling a specific function: 1. Calling function name should be matched with function name in the function definition.

22 2. No. of Actual arguments = No. of Formal arguments. 3. The order, data types and returns must be matched. Any function. can be defined in two ways. 1. K & R method (Kernighon & Ritchie ) 2. ANSI method (American National Standard Institution) Function. def. in K & R method: syn. returntupe functionname(args. list) datatype vars ; //body of the function. void add ( x, y) int x, y; //body of the function. Function. def. in ANSI method: syn. returntupe functionname(args. list with datatypes) //body of the function. void add ( int x, int y) //body of the function. Note: Generally, we can use ANSI method only. Types of User-defined functionctions : There are 4 types of user-defined functions. i. with passing args., with no return ii. with passing args., with return iii. without passing args., with no return iv. without passing args, with return Functionction Signature : Def: Function name followed by list of variables is called Function

23 Signature. Syn. Functionname (list of vars); Structures Def: Collection of dissimilar data elements has shared a common name is called a Structure. Syn: struct ST-NAME typedef struct datatype var1; datatype var1; datatype var2; or datatype var2;... ; ST-NAME; Object construction : Syn: struct ST-NAME obj; or ST-NAME obj; struct EMP int eid; char name[20]; char desgn[20]; float sal; ; struct EMP e; Here, e is an object of EMP datatype. Accessing data members : We can access the data members of a structure using dot(.) operator or pointer (->) operator only. EMP e; e.eid e.name e.desgn e.sal EMP *e; e->eid e->name e->desgn e->sal - Structures can be defined above the main() function. Or within the main()function. - Size of the structure means sum of the sizes of the variables

24 defined in the structure definition. - To calculate the size of the structure: o int var= sizeof(structurename/ object); S= sizeof(e); Here, e is the object of EMP structure S is the var. of integer data type. Nested structures: Def: A structure with in a structure is called Nested structure. Syn. struct INNER struct DOB datatype var11; int dd; datatype var12; int mm; int yy; ; ; struct OUTER struct STUDENT datatype var1; int rno; datatype var2; char name[20]; struct INNER in; char course[20]; ; struct DOB date; ; struct OUTER out; struct STUDENT s; Accessing data members using outer object: s.rno; s.name; s.course; s.date.dd; s.date.mm; s.date.yy; Streams Def: Flow of bytes / characters is called Streams. There are two types of streams. Those are, i. I /P stream: Reads data from standard input device (KB) is called i/p stream. ii. O/P stream: Writes /displays data on to standard output device (monitor) is called O/p stream.

25 Files Def: Collection of information stored in a particular medium permanently is called a File. File names are 2 types: i. Primary filename : It is designed by user. It s max. length is 8 chars only. ii. Extension filename : It is allotted by its application by default. It can allow up to 3 chars. Note: - Primary filename and extension names are separated by a dot. - Each and every file can follows 8.3 rules. Hello.doc Myfile.txt Stddata.xls Total.c Palindrome.cpp Myweb.java Types of Files : There are many types in files. - Text files [The files, which are created in Notepad application only]: It can allow only chars. - Document files [The files, which are created in Ms-word application only]: It can allow text / diagrams/ pics. etc. - Data base files [The files, which are created in MS-Access application etc] - Audio / video files - Jpeg / jpg files - Image files etc. Data Base : It is the relationship between different tables. Table: The data is stored in the form of rows and columns. Row / Record : Collection of related field items in the table. A row of information represents a record in a table / file. Field: An individual data item (column) in the table is called a field. Advantages of files :

26 To store the data permanently. Easy to retrieve required data from a file. Etc. Operations on Files : - Create a new file. - Open an existing file. - Close an existing file. - Store data into a file. - Adding new data to the existing file - Retrieving / reading data from a file. - Modifying / update data from in a file - Searching required data from a file. - Delete data from a file. - Copy a file to another file. - Merge of two files. - Remove a file from disc (source). - Rename a file etc. Functionctions used in Files : The following Function are defined in the header file stdio.h. FILE : - Pre-defined structure. - Its pointer var. can search a file from the local disc. - Its var. must be declared as pointer only. Because, it can stores the address of opened file. Syn: FILE *fileptr; FILE *fp; - fopen() : It can be used for creating a new file or opening an existing file. Syn: FILE *fileptr ; fileptr = fopen (filename, mode) ; - fclose(): It can be used for closing opened files. Every opened file must be closed. Syn:

27 fclose (fileptr); - fgetc(): It reads a single character from a file. Syn: Var = fgetc(fileptr); -fputc( ) / fputch( ): It stores a single character into a file. Syn: fputc (var, fileptr); - fgets(): It reads a string from a file. Syn. fgets( var, size, fileptr); -fputs(): It stores /writes a string into a file. Syn: fputs (var, fileptr); -EOF : End Of File. -feof( ): It represents File end of File. Syn. feof(fileptr) fprintf() : It can be used for storing/ displaying the details into a file. Syn. fprintf (fileptr, formatting string, list of vars) ; fscanf(): It can be used for reading / retrieving data from a file. Syn. fscanf(fileptr, formatting chars, list of vars.) ; fwrite(): It can store / displays details of an object into a file. Syn. fwrite ( &obj, sizeof(obj), no.of objs, fileptr) ;

28 fread(): It can read / retrieve details of an object from a file. Syn. fread ( &obj, sizeof(obj), no.of objs, fileptr) ; rewind( ): It can move the control to the beginning of the file. Syn. rewind (fileptr) ; rename ( ): To rename a file. That means to change the name of the file. Syn. rename (oldname, newname) ; remove(): It can remove a file from disc. Syn. remove (filename); fseek(): To moves the control to the specific location in the file. Syn. fseek(location, sizof(obj), const) ; Here, const SEEK_BEG SEEK_END SEEK_CUR File Opening Modes There are mainly 6 types of modes in files. Those are, Mode is string only. So, it must be placed in double quotes only. Mode Meaning r Reading data from a file w Writing data into a file a Appending data to a file r+ Reading / writing data from / to a file. Modification is allowed. w+ Writing data into a file and reads they back. Modification is allowed. a+ Appending data into a file and reads they back. But, Modification is not allowed.

Multiple Choice Questions ( 1 mark)

Multiple Choice Questions ( 1 mark) Multiple Choice Questions ( 1 mark) Unit-1 1. is a step by step approach to solve any problem.. a) Process b) Programming Language c) Algorithm d) Compiler 2. The process of walking through a program s

More information

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are

More information

Model Viva Questions for Programming in C lab

Model Viva Questions for Programming in C lab Model Viva Questions for Programming in C lab Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart is a diagram that shows a continuous

More information

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9 Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits

More information

C mini reference. 5 Binary numbers 12

C mini reference. 5 Binary numbers 12 C mini reference Contents 1 Input/Output: stdio.h 2 1.1 int printf ( const char * format,... );......................... 2 1.2 int scanf ( const char * format,... );.......................... 2 1.3 char

More information

I BCA[ ] SEMESTER I CORE: C PROGRAMMING - 106A Multiple Choice Questions.

I BCA[ ] SEMESTER I CORE: C PROGRAMMING - 106A Multiple Choice Questions. 1 of 22 8/4/2018, 4:03 PM Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

CSCI 171 Chapter Outlines

CSCI 171 Chapter Outlines Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures

More information

Main Program. C Programming Notes. #include <stdio.h> main() { printf( Hello ); } Comments: /* comment */ //comment. Dr. Karne Towson University

Main Program. C Programming Notes. #include <stdio.h> main() { printf( Hello ); } Comments: /* comment */ //comment. Dr. Karne Towson University C Programming Notes Dr. Karne Towson University Reference for C http://www.cplusplus.com/reference/ Main Program #include main() printf( Hello ); Comments: /* comment */ //comment 1 Data Types

More information

C PROGRAMMING. Characters and Strings File Processing Exercise

C PROGRAMMING. Characters and Strings File Processing Exercise C PROGRAMMING Characters and Strings File Processing Exercise CHARACTERS AND STRINGS A single character defined using the char variable type Character constant is an int value enclosed by single quotes

More information

today cs3157-fall2002-sklar-lect05 1

today cs3157-fall2002-sklar-lect05 1 today homework #1 due on monday sep 23, 6am some miscellaneous topics: logical operators random numbers character handling functions FILE I/O strings arrays pointers cs3157-fall2002-sklar-lect05 1 logical

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

More information

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING

UNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING SIDDARTHA INSTITUTE OF SCIENCE AND TECHNOLOGY:: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : PROGRAMMING FOR PROBLEM SOLVING (18CS0501) Course & Branch

More information

SAE1A Programming in C. Unit : I - V

SAE1A Programming in C. Unit : I - V SAE1A Programming in C Unit : I - V Unit I - Overview Character set Identifier Keywords Data Types Variables Constants Operators SAE1A - Programming in C 2 Character set of C Character set is a set of

More information

C Programming Multiple. Choice

C Programming Multiple. Choice C Programming Multiple Choice Questions 1.) Developer of C language is. a.) Dennis Richie c.) Bill Gates b.) Ken Thompson d.) Peter Norton 2.) C language developed in. a.) 1970 c.) 1976 b.) 1972 d.) 1980

More information

Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and

Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and #include The Use of printf() and scanf() The Use of printf()

More information

Chapter 2 - Introduction to C Programming

Chapter 2 - Introduction to C Programming Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic

More information

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

More information

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE COURSE TITLE C LANGUAGE DETAILED SYLLABUS SR.NO NAME OF CHAPTERS & DETAILS HOURS ALLOTTED 1 INTRODUCTION TO C LANGUAGE About C Language Advantages of C Language Disadvantages of C Language A Sample Program

More information

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with

More information

A function is a named group of statements developed to solve a sub-problem and returns a value to other functions when it is called.

A function is a named group of statements developed to solve a sub-problem and returns a value to other functions when it is called. Chapter-12 FUNCTIONS Introduction A function is a named group of statements developed to solve a sub-problem and returns a value to other functions when it is called. Types of functions There are two types

More information

Lecture 02 C FUNDAMENTALS

Lecture 02 C FUNDAMENTALS Lecture 02 C FUNDAMENTALS 1 Keywords C Fundamentals auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void

More information

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are: LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words

More information

Appendix A Developing a C Program on the UNIX system

Appendix A Developing a C Program on the UNIX system Appendix A Developing a C Program on the UNIX system 1. Key in and save the program using vi - see Appendix B - (or some other editor) - ensure that you give the program file a name ending with.c - to

More information

Fundamentals of Computer Programming Using C

Fundamentals of Computer Programming Using C CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar Faculty Name: Ami D. Trivedi Class: FYBCA Subject: US01CBCA01 (Fundamentals of Computer Programming Using C) *UNIT 3 (Structured Programming, Library Functions

More information

Chapter 21: Introduction to C Programming Language

Chapter 21: Introduction to C Programming Language Ref. Page Slide 1/65 Learning Objectives In this chapter you will learn about: Features of C Various constructs and their syntax Data types and operators in C Control and Loop Structures in C Functions

More information

IV Unit Second Part STRUCTURES

IV Unit Second Part STRUCTURES STRUCTURES IV Unit Second Part Structure is a very useful derived data type supported in c that allows grouping one or more variables of different data types with a single name. The general syntax of structure

More information

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING

UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered )   FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING ( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING INTRODUCTION TO C UNIT IV Overview of C Constants, Variables and Data Types

More information

Computer Science & Information Technology (CS) Rank under AIR 100. Examination Oriented Theory, Practice Set Key concepts, Analysis & Summary

Computer Science & Information Technology (CS) Rank under AIR 100. Examination Oriented Theory, Practice Set Key concepts, Analysis & Summary GATE- 2016-17 Postal Correspondence 1 C-Programming Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts, Analysis

More information

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23.

IECD Institute for Entrepreneurship and Career Development Bharathidasan University, Tiruchirappalli 23. Subject code - CCP01 Chapt Chapter 1 INTRODUCTION TO C 1. A group of software developed for certain purpose are referred as ---- a. Program b. Variable c. Software d. Data 2. Software is classified into

More information

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Introduction to C Programming Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Printing texts Adding 2 integers Comparing 2 integers C.E.,

More information

C programming basics T3-1 -

C programming basics T3-1 - C programming basics T3-1 - Outline 1. Introduction 2. Basic concepts 3. Functions 4. Data types 5. Control structures 6. Arrays and pointers 7. File management T3-2 - 3.1: Introduction T3-3 - Review of

More information

Data Types and Variables in C language

Data Types and Variables in C language Data Types and Variables in C language Basic structure of C programming To write a C program, we first create functions and then put them together. A C program may contain one or more sections. They are

More information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

INDORE INDIRA SCHOOL OF CAREER STUDIES C LANGUAGE Class B.Sc. - IIND Sem

INDORE INDIRA SCHOOL OF CAREER STUDIES C LANGUAGE Class B.Sc. - IIND Sem UNIT- I ALGORITHM: An algorithm is a finite sequence of instructions, a logic and explicit step-by-step procedure for solving a problem starting from a known beginning. OR A sequential solution of any

More information

Computers Programming Course 5. Iulian Năstac

Computers Programming Course 5. Iulian Năstac Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

Questions Bank. 14) State any four advantages of using flow-chart

Questions Bank. 14) State any four advantages of using flow-chart Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State

More information

Long Questions. 7. How does union help in storing the values? How it differs from structure?

Long Questions. 7. How does union help in storing the values? How it differs from structure? Long Questions April/May - 2010 Marks 1. Explain arithmetic operators and their precedence in C. 2. Explain the term structured programming with help of example 3. Write a program to read 10 numbers and

More information

PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo

PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo 1. (a)what is an algorithm? Draw a flowchart to print N terms of Fibonacci

More information

Chapter 1 & 2 Introduction to C Language

Chapter 1 & 2 Introduction to C Language 1 Chapter 1 & 2 Introduction to C Language Copyright 2007 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 1 & 2 - Introduction to C Language 2 Outline 1.1 The History

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : I / II Section : CSE - 1 & 2 Subject Code : CS6202 Subject Name : Programming and Data Structures-I Degree & Branch : B.E C.S.E. 2 MARK

More information

C Programming Class I

C Programming Class I C Programming Class I Generation of C Language Introduction to C 1. In 1967, Martin Richards developed a language called BCPL (Basic Combined Programming Language) 2. In 1970, Ken Thompson created a language

More information

Advanced C Programming and Introduction to Data Structures

Advanced C Programming and Introduction to Data Structures FYBCA Semester II (Advanced C Programming and Introduction to Data Structures) Question Bank Multiple Choice Questions Unit-1 1. Which operator is used with a pointer to access the value of the variable

More information

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below:

Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below: Q1. Explain the structure of a C program Structure of the C program is shown below: Preprocessor Directives Global Declarations Int main (void) Local Declarations Statements Other functions as required

More information

Strings and Library Functions

Strings and Library Functions Unit 4 String String is an array of character. Strings and Library Functions A string variable is a variable declared as array of character. The general format of declaring string is: char string_name

More information

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Fundamental of C Programming Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Q2. Write down the C statement to calculate percentage where three subjects English, hindi, maths

More information

Fundamental of C programming. - Ompal Singh

Fundamental of C programming. - Ompal Singh Fundamental of C programming - Ompal Singh HISTORY OF C LANGUAGE IN 1960 ALGOL BY INTERNATIONAL COMMITTEE. IT WAS TOO GENERAL AND ABSTRUCT. IN 1963 CPL(COMBINED PROGRAMMING LANGUAGE) WAS DEVELOPED AT CAMBRIDGE

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS 1. Define global declaration? The variables that are used in more

More information

Basics of Programming

Basics of Programming Unit 2 Basics of Programming Problem Analysis When we are going to develop any solution to the problem, we must fully understand the nature of the problem and what we want the program to do. Without the

More information

About Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals

More information

Course Title: C Programming Full Marks: Course no: CSC110 Pass Marks: Nature of course: Theory + Lab Credit hours: 3

Course Title: C Programming Full Marks: Course no: CSC110 Pass Marks: Nature of course: Theory + Lab Credit hours: 3 Detailed Syllabus : Course Title: C Programming Full Marks: 60+20+20 Course no: CSC110 Pass Marks: 24+8+8 Nature of course: Theory + Lab Credit hours: 3 Course Description: This course covers the concepts

More information

Course Outline Introduction to C-Programming

Course Outline Introduction to C-Programming ECE3411 Fall 2015 Lecture 1a. Course Outline Introduction to C-Programming Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,

More information

Contents. Preface. Introduction. Introduction to C Programming

Contents. Preface. Introduction. Introduction to C Programming c11fptoc.fm Page vii Saturday, March 23, 2013 4:15 PM Preface xv 1 Introduction 1 1.1 1.2 1.3 1.4 1.5 Introduction The C Programming Language C Standard Library C++ and Other C-Based Languages Typical

More information

CS6202 - PROGRAMMING & DATA STRUCTURES UNIT I Part - A 1. W hat are Keywords? Keywords are certain reserved words that have standard and pre-defined meaning in C. These keywords can be used only for their

More information

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler

More information

BCA-105 C Language What is C? History of C

BCA-105 C Language What is C? History of C C Language What is C? C is a programming language developed at AT & T s Bell Laboratories of USA in 1972. It was designed and written by a man named Dennis Ritchie. C seems so popular is because it is

More information

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.

More information

Recap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam

Recap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam Multimedia Programming 2004 Lecture 2 Erwin M. Bakker Joachim Rijsdam Recap Learning C++ by example No groups: everybody should experience developing and programming in C++! Assignments will determine

More information

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Unit-II Programming and Problem Solving (BE1/4 CSE-2) Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite

More information

Object Oriented Pragramming (22316)

Object Oriented Pragramming (22316) Chapter 1 Principles of Object Oriented Programming (14 Marks) Q1. Give Characteristics of object oriented programming? Or Give features of object oriented programming? Ans: 1. Emphasis (focus) is on data

More information

UNIT IV INTRODUCTION TO C

UNIT IV INTRODUCTION TO C UNIT IV INTRODUCTION TO C 1. OVERVIEW OF C C is portable, structured programming language. It is robust, fast.extensible. It is used for complex programs. The root of all modern language is ALGOL (1960).

More information

Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6. Iulian Năstac Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

More information

UNIT IV-2. The I/O library functions can be classified into two broad categories:

UNIT IV-2. The I/O library functions can be classified into two broad categories: UNIT IV-2 6.0 INTRODUCTION Reading, processing and writing of data are the three essential functions of a computer program. Most programs take some data as input and display the processed data, often known

More information

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved. C How to Program, 6/e Storage of data in variables and arrays is temporary such data is lost when a program terminates. Files are used for permanent retention of data. Computers store files on secondary

More information

ET156 Introduction to C Programming

ET156 Introduction to C Programming ET156 Introduction to C Programming g Unit 22 C Language Elements, Input/output functions, ARITHMETIC EXPRESSIONS AND LIBRARY FUNCTIONS Instructor : Stan Kong Email : skong@itt tech.edutech.edu General

More information

Unit 6 Files. putchar(ch); ch = getc (fp); //Reads single character from file and advances position to next character

Unit 6 Files. putchar(ch); ch = getc (fp); //Reads single character from file and advances position to next character 1. What is File management? In real life, we want to store data permanently so that later on we can retrieve it and reuse it. A file is a collection of bytes stored on a secondary storage device like hard

More information

Review of the C Programming Language for Principles of Operating Systems

Review of the C Programming Language for Principles of Operating Systems Review of the C Programming Language for Principles of Operating Systems Prof. James L. Frankel Harvard University Version of 7:26 PM 4-Sep-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights

More information

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be

More information

AIR FORCE SCHOOL,BAMRAULI COMPUTER SCIENCE (083) CLASS XI Split up Syllabus (Session ) Contents

AIR FORCE SCHOOL,BAMRAULI COMPUTER SCIENCE (083) CLASS XI Split up Syllabus (Session ) Contents AIR FORCE SCHOOL,BAMRAULI COMPUTER SCIENCE (083) CLASS XI Split up Syllabus (Session- 2017-18) Month July Contents UNIT 1: COMPUTER FUNDAMENTALS Evolution of computers; Basics of computer and its operation;

More information

ENG120. Misc. Topics

ENG120. Misc. Topics ENG120 Misc. Topics Topics Files in C Using Command-Line Arguments Typecasting Working with Multiple source files Conditional Operator 2 Files and Streams C views each file as a sequence of bytes File

More information

BLM2031 Structured Programming. Zeyneb KURT

BLM2031 Structured Programming. Zeyneb KURT BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help

More information

COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR. VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS

COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR.  VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS S.LAWRENCE CHRISTOPHER, M.C.A., B.Ed., LECTURER IN COMPUTER SCIENCE PONDICHERRY

More information

Continued from previous lecture

Continued from previous lecture The Design of C: A Rational Reconstruction: Part 2 Jennifer Rexford Continued from previous lecture 2 Agenda Data Types Statements What kinds of operators should C have? Should handle typical operations

More information

A flow chart is a graphical or symbolic representation of a process.

A flow chart is a graphical or symbolic representation of a process. Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of

More information

C-LANGUAGE CURRICULAM

C-LANGUAGE CURRICULAM C-LANGUAGE CURRICULAM Duration: 2 Months. 1. Introducing C 1.1 History of C Origin Standardization C-Based Languages 1.2 Strengths and Weaknesses Of C Strengths Weaknesses Effective Use of C 2. C Fundamentals

More information

Computer Programming Unit v

Computer Programming Unit v READING AND WRITING CHARACTERS We can read and write a character on screen using printf() and scanf() function but this is not applicable in all situations. In C programming language some function are

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

Split up Syllabus (Session )

Split up Syllabus (Session ) Split up Syllabus (Session- -17) COMPUTER SCIENCE (083) CLASS XI Unit No. Unit Name Marks 1 COMPUTER FUNDAMENTALS 10 2 PROGRAMMING METHODOLOGY 12 3 INTRODUCTION TO C++ 14 4 PROGRAMMING IN C++ 34 Total

More information

Q 1. Attempt any TEN of the following:

Q 1. Attempt any TEN of the following: Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The

More information

OBJECT ORIENTED PROGRAMMING

OBJECT ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING LAB 1 REVIEW THE STRUCTURE OF A C/C++ PROGRAM. TESTING PROGRAMMING SKILLS. COMPARISON BETWEEN PROCEDURAL PROGRAMMING AND OBJECT ORIENTED PROGRAMMING Course basics The Object

More information

FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C

FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT IV INTRODUCTION TO C Overview of C Constants, Variables and Data Types Operators and Expressions Managing Input and Output operators Decision Making

More information

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

C Language, Token, Keywords, Constant, variable

C Language, Token, Keywords, Constant, variable C Language, Token, Keywords, Constant, variable A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language. C

More information

Presented By : Gaurav Juneja

Presented By : Gaurav Juneja Presented By : Gaurav Juneja Introduction C is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs of UNIX are written

More information

C Libraries. Bart Childs Complementary to the text(s)

C Libraries. Bart Childs Complementary to the text(s) C Libraries Bart Childs Complementary to the text(s) 2006 C was designed to make extensive use of a number of libraries. A great reference for student purposes is appendix B of the K&R book. This list

More information

Model Viva Questions for Programming in C lab

Model Viva Questions for Programming in C lab Model Viva Questions for Programming in C lab Common to: CSE 2 nd sem IT 2 nd sem Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart

More information

4.1. Structured program development Overview of C language

4.1. Structured program development Overview of C language 4.1. Structured program development 4.2. Data types 4.3. Operators 4.4. Expressions 4.5. Control flow 4.6. Arrays and Pointers 4.7. Functions 4.8. Input output statements 4.9. storage classes. UNIT IV

More information

C Programming. Unit 9. Manipulating Strings File Processing.

C Programming. Unit 9. Manipulating Strings File Processing. Introduction to C Programming Unit 9 Manipulating Strings File Processing skong@itt-tech.edu Unit 8 Review Unit 9: Review of Past Material Unit 8 Review Arrays Collection of adjacent memory cells Each

More information

Princeton University Computer Science 217: Introduction to Programming Systems The Design of C

Princeton University Computer Science 217: Introduction to Programming Systems The Design of C Princeton University Computer Science 217: Introduction to Programming Systems The Design of C C is quirky, flawed, and an enormous success. While accidents of history surely helped, it evidently satisfied

More information

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. I Internal Examination Sept. 2018 Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. [I]Very short answer questions (Max 40 words). (5 * 2 = 10) 1. What is

More information

Arrays, Strings, & Pointers

Arrays, Strings, & Pointers Arrays, Strings, & Pointers Alexander Nelson August 31, 2018 University of Arkansas - Department of Computer Science and Computer Engineering Arrays, Strings, & Pointers Arrays, Strings, & Pointers are

More information

The Design of C: A Rational Reconstruction: Part 2

The Design of C: A Rational Reconstruction: Part 2 The Design of C: A Rational Reconstruction: Part 2 1 Continued from previous lecture 2 Agenda Data Types Operators Statements I/O Facilities 3 Operators Issue: What kinds of operators should C have? Thought

More information

Programming. Elementary Concepts

Programming. Elementary Concepts Programming Elementary Concepts Summary } C Language Basic Concepts } Comments, Preprocessor, Main } Key Definitions } Datatypes } Variables } Constants } Operators } Conditional expressions } Type conversions

More information

Chapter 8 C Characters and Strings

Chapter 8 C Characters and Strings Chapter 8 C Characters and Strings Objectives of This Chapter To use the functions of the character handling library (). To use the string conversion functions of the general utilities library

More information