UNIT - I. Introduction to C Programming. BY A. Vijay Bharath
|
|
- Mervin Jennings
- 6 years ago
- Views:
Transcription
1 UNIT - I Introduction to C Programming
2 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 closely associated with the UNIX operating system where it was developed, since both the system and most of the programs that run on it are written in C.
3 Introduction to C It is a language with features economy of expression, modern flow control and data structures, and a rich set of operators. The language, however, is not tied to any one operating system or machine; and although it has been called a ``system programming language'' because it is useful for writing compilers and operating systems.
4 Introduction to C C provides the fundamental control-flow constructions required for well-structured programs: statement grouping, decision making (if-else), selecting one of a set of possible values (switch), looping with the termination test at the top (while, for) or at the bottom (do), and early loop exit (break).
5 Simple structure of a C program Inclusion of header files Inclusion of main( ) function Declaration Part i.e. Declaration of variables with corresponding Data types. Set of instructions using C syntax. End of Program statement
6 Simple Program /* Comment statements */ /* The Hello World program */ Preprocessor directives main() { Program statements; } # include <stdio.h> main() { printf( Hello World\n ); }
7 Sample C program # include<stdio.h> main( ) { int a, b, c, sum; a = 1; b = 2; c = 3; sum = a + b + c; printf("sum is %d", sum); }
8 Formal Structure of C Documentation section Link section Definition section Global declaration Main( ) Function section { Declaration Part, Executable Part } Subprogram section Function 1 Function 2 (User defined Function) Function n
9 The documentation section consists of a set of comment lines giving the name of the program, the author and other details. The link section provides instruction to the compiler to link function from the system library. The definition section defines all symbolic constants. There are some variables that are used in more than one function. Such variables are called global variables. Main() function two parts, declaration and executable part. The Declaration part declares all the variables used in executable part.
10 The program execution begins at the opening brace and ends at the closing braces. The closing braces of the main() function section is the logical end of the program. The subprogram section contains all the userdefined functions that are called in the main() function. User-defined functions are generally placed immediately after the main() function.
11 Executing a C program 1. Creating the program. 2. Compiling the program. 3. Linking the program with function that are needed from the C library. 4. Executing the program.
12 Points to remember 1. Every C program requires a main() function (use of more than one main() is illegal). 2. The execution of a function begins at the opening brace of the function and ends at the corresponding close brace. 3. C programs are written in lowercase letters. However, uppercase letters are used for symbolic names and output strings. 4. Al the programming words must be separated by at least one space. 5. Every program statement in a C program must end with a Semicolon(;)
13 The C character Set C uses uppercase letters A to Z, the lowercase letters a to z, the digits 0 to 9, and certain special characters as building blocks to form basic program. The special characters are listed below. + - * / = % & #!? ^ ~ \ < > ( ) [ ] { } : ;., _ $
14 The C character Set C uses certain combinations of these characters, such as \b, \n, and \t, to represent special conditions such as backspace, newline, and horizontal tab, respectively. These character combinations are known as escape sequences.
15 Identifiers and Keywords Identifiers are names that are given to various program elements, such as variables, functions and arrays. Identifiers consists of letters and digits, in any order, except that the first character must be a letter. Both upper and lower case letters are permitted. The underscore character ( _) can also be included, and is considered to be a letter.
16 Valid identifiers X y12 sum_1 _temperature Name area tax_rate TABLE Invalid Identifiers 4 th the first character must be a letter x Illegal character ( ) Order-no Illegal character (-) Error flag Illegal character (blank space)
17 Keywords There are certain reserved words, called keywords, that have standard, predefined meaning in C. The keyword can be used only for their intended purpose. E.g. auto extern sizeof break static case for struct char goto switch if int double union Void do while else return
18 Data types C language is rich in its data types. The variety of data types available allow the programmer to select the type appropriate to the needs of the applications as well as the machine The fundamental data types, namely integer (int), character (char), floating point (float), and doubleprecision floating point (double)
19 Data types Type Size (bits) Range Char to 127 Integer 16-32, 768 to 32, 767 Float E-38 to 3.4E+38 Double E-308 to 1.7E+308 Declaration of variables int count; Int number, total; Char s;
20 User-Defined data types C supports a feature known as type definition that allows users to define an identifier that would represent an existing data type. Format : typedef type identifier; Where type refers to an existing data type and identifier refers to the new name given to the data type.
21 typedef int units; typedef float marks; Here, units symbolizes int and marks symbolizes float. units batch1, batch2; marks name1[50], name2[50]; batch1 and batch2 are declared as int variable and name1[50] and name2[50] are declared as 50 element floating point array variables.
22 Constants Constants in C refers to fixed value that do not change during the execution of a program. Integer consist of a set of digits, 0 to 9, preceded by an optional or + sign. Valid constants are
23 Invalid constants ,000 $1000 Real constants These constants are represented by number containing fractional parts like e.g
24 Character Constant A single character constant contains a single character enclosed within a pair of single quote marks. E.g. 5 X Note that the character constant 5 is not same as number 5. the last constant is blank space. Character constant have integer values known as ASCII values printf( %d, a ); > will print the number 97 printf( %c, 97 ); > will print the letter a
25 String Constant A string constant is a sequence of characters enclosed in double quotes. The character may be letters, number, special characters and blank space. E.g. Hello 1987 X Remember that a character constant X is not equivalent to the single character constant X.
26 Backslash Character Constant constant Meaning \a Audible alert \b Back space \n New line \t Horizontal tab \v Vertical tab \0 Null \\ Backslash \ Single quote \ Double quote
27 VARIABLES A variable is a data name that may be used to store a data value. A variable may take different values at different times during execution. A variable name can be chosen by the programmer in a meaningful way. Valid: john Value T_raise sum1 mark Invalid: 123 (area)
28 First_tag char Price$ group one average_number int_type Variable Declaration Syntax: datatype v1,v2,.., vn; Variables are separated by commas, and declaration statement must end with a semicolon. E.g. int count; int number, total;
29 ARRAYS A array is a kind of variable that is used extensively in C. An array is an identifier that refers to a collection of data items that all have the same name. The data items must all be of the same type (e.g. all integers, all characters). The individual data item are represented by their corresponding array element. E.g. int a[10]; a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7] a[8] a[9]
30 ARRAYS E.g. int a[5]; The values of array element can be assigned as follows. a[0]=35; a[1]=40; a[2]=20; a[3]=57; a[4]=19; This would cause the array a to store values as shown below. a[0] a[1] a[2] a[3] a[4]
31 ARRAYS The following are the valid statements : A = a[0] + 10; A[4] = a[0] + a[2]; Value[6] = a[3] * 6; E.g. float height[50]; Which declares the height to be an array containing 50 real elements. The C language treats character strings simply as array of characters. The size in a character string represents the maximum number of characters that a string can hold.
32 ARRAYS E.g. char name[10]; Declares the name as a character array variable that can hold a maximum of 10 characters. Suppose WELL DONE is a string that is stored in the memory as follows: We must always allow one extra element space for the null terminator. W E L L D O N E \0
33 Two-Dimensional Arrays Organized in the form of rows and columns E.g. int a[5][5]; a[0] a[1] a[2] a[3] a[4] a[5] a[0] a[1] a[2] a[3] a[4] a[5]
34 for (i=1;i<=5;i++) { for(j=1;j<=5;j++) { Scanf( %d, &a[ i ] [ j ]); } }
35 Operators and Expressions C operators can be classified into a number of categories. They include: 1. Arithmetic operators. 2. Relational operators. 3. Logical operators. 4. Assignment operators 5. Increment and decrement operators 6. Conditional operators.
36 1. Arithmetic operators C provides all the basic arithmetic operators as given below: operator Meaning + Addition - Subtraction * Multiplication / Division % Modulo division E.g. a+b; a-b; a*b; a/b; a%b;
37 2. Relational operators The comparison can be done by relational operator. The expression (a < b or 1 < 20) containing a relational operator is termed as a relational expression. If the relation is true it is one or the relation is false it is zero. operator Meaning < is less than > is greater than <= is less than or equal to >= is greater than or equal to == is equal to!= is not equal to
38 3. Logical operators C has he following three logical operators. operator Meaning && logical AND logical OR! Logical NOT The logical operators && and are used when we want to test more than one condition and make decision. E.g. (a > b && x ==10)
39 4. Assignment operator Assignment operators are used to assign the result of an expression to a variable. E.g. C=a+b; In addition, C has a set of shorthand assignment operators of the form: Stmt. with simple Stmt. with assgn. Operator shorthand operator a=a+1 a+=1 a=a-1 a-=1 a=a*(n+1) a*=n+1 Note: 1) what appears on the left-side need not be repeated and therefore easier to write 2) the statement is more efficient.
40 5. Increment and decrement operators C has two very useful operators not generally found in other languages. These are increment ( + + )and decrement operators ( - - ). The operator + + adds 1, while - - subtracts1. E.g. + + m; and m + +; mean the same thing when they form statements independently. They behave differently when they are used in the expressions on the right-hand side of an assignment statement. Consider the following.
41 5. Increment and decrement operators M = 5; Y= + + m; In this case, the value of y and m would be 6. suppose if we rewrite the above statement as M = 5; Y= m + +; Then, the value of y would be 5 and m would be 6.
42 5. Increment and decrement operators The unusual feature of `+ +' and `- -' is that they can be used either before or after a variable. The value of + + k is the value of k after it has been incremented. The value of k + + is k before it is incremented. E.g. Suppose k is 5. Then x = + + k; Increments k to 6 and then sets x to the resulting value, i.e., to 6. But x = k++; first sets x to 5, and then increments k to 6. The incrementing effect of ++k and k++ is the same, but their values are respectively 5 and 6.
43 6. Conditional operator A ternary operator pair? : is available in C to construct conditional expressions of the form: exp1? exp2 : exp3; Where exp1, exp2, exp3 are expressions. First exp1 is evaluated, if it is non zero (true) then the exp2 is evaluated and becomes the value of the expression. If exp1 is false, exp3 is evaluated and its value becomes the value of the expression. e.g. A=10; b=15; x=(a>b)? a : b; If (a>b) X=a; Else X=b; is same as
44 Arithmetic expressions An arithmetic expression is a combination of variables, constants, and operators arranged as per the syntax of the language. C language can handle complex mathematical expressions. algebraic expressions C expressions a x b c a * b c (m+n) (x+y) (m+n) * (x+y) ab c a * b / c 3x 2 + 2x * x * X + 2 * X + 1 x + c y x / y + c
45 Precedence of Arithmetic operator An arithmetic expression without parenthesis will be evaluated from left to right using the rules of precedence of operators. There are two distinct priority levels of arithmetic operators in C. High priority * / % Low priority + - During the first pass, the high priority operators are applied as they are encountered. During the second pass, the low priority operators are applied as they are encountered.
46 Library functions The C language is accompanied by a number library functions that carry out various commonly used operations or calculations. There are some library functions that carry out standard input / output operations (e.g. read and write characters, read and write numbers, open and close files, etc). Functions that perform operations on characters (e.g. convert from lower- to upper) functions that performs operations on strings (e.g. copy a string, compare a string, concatenate strings, etc). Library functions that are functionally similar are usually grouped together as (compiled) object program in separate library files. A typical set of library functions will include a fairly large number of functions that are common to most C compilers.
47 Library functions abs(i) - return the absolute value of i. ceil(d) - round up to the next integer value. cos(d) - return the cosine of d. log(d) - return the natural logarithm of d. printf(.) - send data items to the standard output device. scanf( ) - enter data items from the standard input device. tolower(c) - convert letter to lowercase. toupper(c) - convert letter to uppercase. getchar( ) - enter a character from a standard input device. putchar( ) - send a character to the standard output device. sqrt(d) - returns a square root of d.
48 Library functions A library function is accessed simply by writing the function name, followed by a list of arguments that represent information being passed to a function. The arguments must be enclosed in parentheses and separated by commas. The arguments can be constants, variable names, or more complex expressions
49 Data input and output SINGLE CHARACTER INPUT THE getchar( ) FUNCTION Single character can be entered into the computer using the C library function getchar( ). The getchar( ) function is a part of the standard C I/O library. It returns a single character from a standard input device (typically a keyboard). The function does not require any arguments, though a pair of empty parentheses must follow the word getchar( ). SYNTAX: character variable = getchar( ); E.g. char c; c = getchar( );
50 Data input and output SINGLE CHARACTER OUTPUT THE putchar( ) FUNCTION Single character can be displayed using C library function putchar(). It transmits a single character to a standard output device ( typically a monitor) It must be expressed as an argument to the function, enclosed in parentheses, following the word putchar( ). SYNTAX: putchar (character variable ); E.g. char c; putchar(c);
51 Entering input data The scanf Function Input data can be entered into the computer from a standard input device by means of the C library function scanf. This function can be used to enter any combination of numerical values, single characters and strings. The function returns the number of data items that have been entered successfully. syntax: scanf( control string, arg1, arg2,.... argn); Where control string refers to a string containing certain required formatting information, and arg1, arg2,... argn are arguments that represent the individual input data items. The control string consists of individual groups of characters with one character group for each input data item.
52 Entering input data The scanf Function Each character group must begin with a percent sign (%). Conversion character c d f h i o x s Data item is a single character Data item is a decimal integer Meaning Data item is a floating-point value Data item is a short integer Data item is a decimal, hexadecimal or octal integer Data item is an octal integer Data item is a hexadecimal integer Data item is a string (null \0 will automatically added at end)
53 Entering output data The printf function Output data can be written from the computer onto a standard output device using the C library function printf. This function can be used to output any numerical values, ingle character and strings. The printf function moves data from the computer s memory to the standard output device. syntax: printf( control string, arg1, arg2,.... argn);
54 Conversion character c d f i o x s Meaning Data item is displayed as single character Data item is displayed as decimal integer Data item is displayed as floating-point value Data item is displayed as signed decimal integer Data item is displayed as octal integer Data item is displayed as hexadecimal integer Data item is displayed as string
55 Assignment C datatypes 2. Variables and Arrays. Submission date: 04/10/2007
56 END OF UNIT - I
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 informationData 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 informationC: 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 informationANSI C Programming Simple Programs
ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double
More informationB.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 informationChapter 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 informationFundamental 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 informationDECLARATIONS. Character Set, Keywords, Identifiers, Constants, Variables. Designed by Parul Khurana, LIECA.
DECLARATIONS Character Set, Keywords, Identifiers, Constants, Variables Character Set C uses the uppercase letters A to Z. C uses the lowercase letters a to z. C uses digits 0 to 9. C uses certain Special
More informationC - Basic Introduction
C - Basic Introduction C is a general-purpose high level language that was originally developed by Dennis Ritchie for the UNIX operating system. It was first implemented on the Digital Equipment Corporation
More information2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants
Data types, variables, constants Outline.1 Introduction. Text.3 Memory Concepts.4 Naming Convention of Variables.5 Arithmetic in C.6 Type Conversion Definition: Computer Program A Computer program is a
More informationData types, variables, constants
Data types, variables, constants 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 in C 2.6 Decision
More informationBasic Elements of C. Staff Incharge: S.Sasirekha
Basic Elements of C Staff Incharge: S.Sasirekha Basic Elements of C Character Set Identifiers & Keywords Constants Variables Data Types Declaration Expressions & Statements C Character Set Letters Uppercase
More informationUNIT 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 informationBasics 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 informationIntroduction 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 informationc) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.
2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C
More informationProgramming in C and Data Structures [15PCD13/23] 1. PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme]
Programming in C and Data Structures [15PCD13/23] 1 PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme] Course objectives: The objectives of this course is to make students
More informationFull file at C How to Program, 6/e Multiple Choice Test Bank
2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)
More informationPresented 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 informationProgramming and Data Structures
Programming and Data Structures Teacher: Sudeshna Sarkar sudeshna@cse.iitkgp.ernet.in Department of Computer Science and Engineering Indian Institute of Technology Kharagpur #include int main()
More informationLESSON 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 informationLESSON 4. The DATA TYPE char
LESSON 4 This lesson introduces some of the basic ideas involved in character processing. The lesson discusses how characters are stored and manipulated by the C language, how characters can be treated
More informationFundamentals of Programming Session 4
Fundamentals of Programming Session 4 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2011 These slides are created using Deitel s slides, ( 1992-2010 by Pearson Education, Inc).
More informationChapter 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 informationProgramming 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 informationINTRODUCTION 1 AND REVIEW
INTRODUTION 1 AND REVIEW hapter SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Programming: Advanced Objectives You will learn: Program structure. Program statements. Datatypes. Pointers. Arrays. Structures.
More informationUNIT- 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 informationChapter 2. Lexical Elements & Operators
Chapter 2. Lexical Elements & Operators Byoung-Tak Zhang TA: Hanock Kwak Biointelligence Laboratory School of Computer Science and Engineering Seoul National Univertisy http://bi.snu.ac.kr The C System
More informationVARIABLES AND CONSTANTS
UNIT 3 Structure VARIABLES AND CONSTANTS Variables and Constants 3.0 Introduction 3.1 Objectives 3.2 Character Set 3.3 Identifiers and Keywords 3.3.1 Rules for Forming Identifiers 3.3.2 Keywords 3.4 Data
More informationLecture 2 Tao Wang 1
Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors
More informationProgramming for Engineers Introduction to C
Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines
More informationComputers 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 informationVariables 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 informationDEPARTMENT 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 informationNumber Systems, Scalar Types, and Input and Output
Number Systems, Scalar Types, and Input and Output Outline: Binary, Octal, Hexadecimal, and Decimal Numbers Character Set Comments Declaration Data Types and Constants Integral Data Types Floating-Point
More informationOperators and Expressions:
Operators and Expressions: Operators and expression using numeric and relational operators, mixed operands, type conversion, logical operators, bit operations, assignment operator, operator precedence
More informationDifferentiate Between Keywords and Identifiers
History of C? Why we use C programming language Martin Richards developed a high-level computer language called BCPL in the year 1967. The intention was to develop a language for writing an operating system(os)
More informationC OVERVIEW. C Overview. Goals speed portability allow access to features of the architecture speed
C Overview C OVERVIEW Goals speed portability allow access to features of the architecture speed C fast executables allows high-level structure without losing access to machine features many popular languages
More informationIntroduction to C Language
Introduction to C Language Instructor: Professor I. Charles Ume ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Introduction to C Language History of C Language In 1972,
More informationProgramming. C++ Basics
Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++
More informationUNIT 3 OPERATORS. [Marks- 12]
1 UNIT 3 OPERATORS [Marks- 12] SYLLABUS 2 INTRODUCTION C supports a rich set of operators such as +, -, *,,
More informationCHAPTER-6 GETTING STARTED WITH C++
CHAPTER-6 GETTING STARTED WITH C++ TYPE A : VERY SHORT ANSWER QUESTIONS 1. Who was developer of C++? Ans. The C++ programming language was developed at AT&T Bell Laboratories in the early 1980s by Bjarne
More informationC OVERVIEW BASIC C PROGRAM STRUCTURE. C Overview. Basic C Program Structure
C Overview Basic C Program Structure C OVERVIEW BASIC C PROGRAM STRUCTURE Goals The function main( )is found in every C program and is where every C program begins speed execution portability C uses braces
More informationPART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.
Unit - III CHAPTER - 9 INTRODUCTION TO C++ Choose the correct answer. PART I 1. Who developed C++? (a) Charles Babbage (b) Bjarne Stroustrup (c) Bill Gates (d) Sundar Pichai 2. What was the original name
More informationCSc Introduction to Computing
CSc 10200 Introduction to Computing Lecture 2 Edgardo Molina Fall 2011 - City College of New York Thursday, September 1, 2011 Introduction to C++ Modular program: A program consisting of interrelated segments
More informationAbout 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 informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationA 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 informationCharacter 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.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar..
.. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. A Simple Program. simple.c: Basics of C /* CPE 101 Fall 2008 */ /* Alex Dekhtyar */ /* A simple program */ /* This is a comment!
More informationThe C++ Language. Arizona State University 1
The C++ Language CSE100 Principles of Programming with C++ (based off Chapter 2 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University
More informationITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University
ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 07: Data Input and Output Readings: Chapter 4 Input /Output Operations A program needs
More informationCOMPUTER 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 informationC 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 informationUnit 1: Introduction to C Language. Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune
Unit 1: Introduction to C Language Saurabh Khatri Lecturer Department of Computer Technology VIT, Pune Introduction to C Language The C programming language was designed by Dennis Ritchie at Bell Laboratories
More informationThese are reserved words of the C language. For example int, float, if, else, for, while etc.
Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationWork relative to other classes
Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language
More informationPES 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 informationFundamental 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 informationSEQUENTIAL STRUCTURE. Erkut ERDEM Hacettepe University October 2010
SEQUENTIAL STRUCTURE Erkut ERDEM Hacettepe University October 2010 History of C C Developed by by Denis M. Ritchie at AT&T Bell Labs from two previous programming languages, BCPL and B Used to develop
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features
More informationCourse 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 information6.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 informationGuide 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 informationSTUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING
OBJECT ORIENTED PROGRAMMING STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING 1. Object Oriented Programming Paradigms 2. Comparison of Programming Paradigms 3. Basic Object Oriented Programming
More informationBITG 1233: Introduction to C++
BITG 1233: Introduction to C++ 1 Learning Outcomes At the end of this lecture, you should be able to: Identify basic structure of C++ program (pg 3) Describe the concepts of : Character set. (pg 11) Token
More informationIntroduction to C# Applications
1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making
More informationUnit 4. Input/Output Functions
Unit 4 Input/Output Functions Introduction to Input/Output Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.
More informationIntro to Computer Programming (ICP) Rab Nawaz Jadoon
Intro to Computer Programming (ICP) Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) What
More informationProgramming in C++ 4. The lexical basis of C++
Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++
More informationOperators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur
Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators
More informationTHE FUNDAMENTAL DATA TYPES
THE FUNDAMENTAL DATA TYPES Declarations, Expressions, and Assignments Variables and constants are the objects that a prog. manipulates. All variables must be declared before they can be used. #include
More information2 nd Week Lecture Notes
2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous
More informationReserved Words and Identifiers
1 Programming in C Reserved Words and Identifiers Reserved word Word that has a specific meaning in C Ex: int, return Identifier Word used to name and refer to a data element or object manipulated by the
More information>B<82. 2Soft ware. C Language manual. Copyright COSMIC Software 1999, 2001 All rights reserved.
>B
More informationBLM2031 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 informationP.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS)
FACULTY: Ms. Saritha P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) SUBJECT / CODE: Programming in C and Data Structures- 15PCD13 What is token?
More informationMultiple 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 informationC-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 informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationCSC 1107: Structured Programming
CSC 1107: Structured Programming J. Kizito Makerere University e-mail: www: materials: e-learning environment: office: alt. office: jkizito@cis.mak.ac.ug http://serval.ug/~jona http://serval.ug/~jona/materials/csc1107
More informationCOMPONENTS OF A COMPUTER
LECTURE 1 COMPONENTS OF A COMPUTER Computer: Definition A computer is a machine that can be programmed to manipulate symbols. Its principal characteristics are: It responds to a specific set of instructions
More informationJAVA Programming Fundamentals
Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol
More informationC Fundamentals & Formatted Input/Output. adopted from KNK C Programming : A Modern Approach
C Fundamentals & Formatted Input/Output adopted from KNK C Programming : A Modern Approach C Fundamentals 2 Program: Printing a Pun The file name doesn t matter, but the.c extension is often required.
More informationIntroduction to C programming. By Avani M. Sakhapara Asst Professor, IT Dept, KJSCE
Introduction to C programming By Avani M. Sakhapara Asst Professor, IT Dept, KJSCE Classification of Software Computer Software System Software Application Software Growth of Programming Languages History
More informationUnit 3. Operators. School of Science and Technology INTRODUCTION
INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.
More informationUnit-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 information1. History of C. 2. Characteristics of C. 3. Basic structure of C programs INTRODUCTION TO C
INTRODUCTION TO C 1. History of C An ancestor of C is BCPL Basic Combined Programming Language. Ken Thompson, a Bell Laboratory scientist, developed a version of BCPL, which he called B. Dennis Ritchie,
More informationME 172. Sourav Saha. Md. Mahamudul Hossain Kazi Fazle Rabbi Saddam Hossain Joy Kamruzzaman Lecturer,Dept. of ME,BUET
ME 172 Introduction to C Programming Language Sourav Saha Md. Mahamudul Hossain Kazi Fazle Rabbi Saddam Hossain Joy Kamruzzaman Lecturer,Dept. of ME,BUET Courtesy: Dr. Noor Al-Quddus Cyrus Ashok Arupratan
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationLecture 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 informationComputer Programming : C++
The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program
More informationDepartment of Computer Applications
Sheikh Ul Alam Memorial Degree College Mr. Ovass Shafi. (Assistant Professor) C Language An Overview (History of C) C programming languages is the only programming language which falls under the category
More informationIECD 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 informationCS6202 - 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 informationThe component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science
The component base of C language Nguyễn Dũng Faculty of IT Hue College of Science Content A brief history of C Standard of C Characteristics of C The C compilation model Character set and keyword Data
More informationMain 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 informationVariables in C. Variables in C. What Are Variables in C? CMSC 104, Fall 2012 John Y. Park
Variables in C CMSC 104, Fall 2012 John Y. Park 1 Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement 2 What Are Variables in C? Variables in C have the
More informationFundamentals 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