C library = Header files + Reserved words + main method
|
|
- Beryl Sherman
- 6 years ago
- Views:
Transcription
1 DAY 1: What are Libraries and Header files in C. Suppose you need to see an Atlas of a country in your college. What do you need to do? You will first go to the Library of your college and then to the Geography shelf and then take out the Atlas of the country you need. Same happens in C language: You first go to the C library use a Header file which you need and then use the functions that are defined in that header file. C library = Header files + Reserved words + main method C library thus contains reserved words, a main method and set of predefined header files that contains predefined functions. You can also create your own header file which will be told later to you. Header files contain various functions or methods. However, Main() method doesn t have any header file. Starting with the C programming: DAY 1: Program #1: A HELLO WORLD PROGRAM..!! The concept of writing the first program as hello world program in every language is that the language evolves in this world and says hello to this new world just like a new born baby appears in a new world. Leaving these weightless talks let s gets started: #include<stdio.> // #include is a pre-processor directive. * void main() // execution of a program starts from main. ** printf( Hello World..!! ); // Used to print Hello World on the console - output window * Thus #include is used to include the header files stored in the include folder of turboc. < > These are used to search the file in the include directory skipping the current one. Thus it is used mainly for system headers. These are used to search the header file in the current directory where the source file is located and then in the include directory. These are used mainly for user-defined header files. Datatypes in C 1. Built-In datatypes a. Fundamental Datatype i. Integer Type: char, int, short, long ii. Floating Type: float, double, long double b. Derived Datatype : Array, Pointers, Structures, Unions 2. User Defined Datatypes: typedef, enum
2 Datatypes in c Explained 1.a Fundamental Datatypes: (Very Important) 1. Char: 1 Byte = 8 Bits So Range = 2 8 = 256 Values a. Signed Char: -2 7 to (which also makes 256 values) b. Unsigned Char: 0 to 255 (which also makes 256 values) 2. Int: 2 Bytes = 8 *2=16 bits So range = 2 16 = a. Signed int: to (which also makes total of 2 16 or values) b. Unsigned int: 0 to (which also makes total of 2 16 or values) 3. Short: 2 Bytes = 16 Bits = 2 16 Values a. short (default) : to or -32,768 to 32,767 b. Unsigned Short : 0 to or 0 to 65, Long: 4 bytes = 32 Bits a. Long(default) : : to or -2,147,483,648 to 2,147,483,647 b. Unsigned Long: 0 to or 0 to 4,294,967,295 Day 1: Program #2: C program to check the size of datatypes using sizeof operator. #include<stdio.h> void main() printf( Storage Size of char is = %d, sizeof(char)); printf( \n Storage size of int is= %d, sizeof(short)); printf( \n Storage size of short is= %d, sizeof(int)); printf( \n Storage size of long is= %d, sizeof(long)); printf( \n Storage size of long long is= %d, sizeof(long long)); Output: Storage Size of char is = 1 Storage Size of short is = 2 Storage Size of int is = 2 Storage Size of long is = 4 Storage Size of long long is = 8 However the size of datatype also depends on the compiler you are using. It may happen that if you are using old compiler turbo c the output may be same but if you are using IDE like codeblocks on a 64 bit architecture then you can get different output. *THIS SECTION IS NOT FOR BEGINNERS For every compiler:- Size of char < size of short < size of int < size of long < size of long long
3 Storage method- Char 8 bits 1 Byte Short 16 bits 2 Bytes Int 32 bits 4 Bytes Long 32 bits for32 bit-environment, 64 bit for 64 bit environment. 4 Bytes 8 Bytes Long Long 64 bit 8 Bytes So OUTPUT FOR PROGRAM #1 Result on 32 Bit-environment OR On 32 Bit TURBO C Storage Size of char is = 1 Storage Size of short is = 2 Storage Size of int is = 2 Storage Size of long is = 4 Storage Size of long long is = 8 Result on 64 Bit-environment OR On IDE- Codeblocks/Visual Studio Storage Size of char is = 1 Storage Size of short is = 2 Storage Size of int is = 4 Storage Size of long is = 8 Storage Size of long long is = 8 DAY 1: Program #3: Write a program to know the range of Datatypes Int, char, short, long. #include<limits.h> #include<stdio.h> void main() printf( Range of short int is:%d to %d,shrt_min,shrt_max); printf( \nsize of Unsigned Short int is:%d,ushrt_max); printf( \nrange of int is : %d to %d,int_min,int_max); printf( \nsize of Unsigned int is:%d,uint_max); printf( \nrange of Long is : %d to %d,long_min,long_max); printf( \nsize of Unsigned Long is:%d,ulong_max); Derived Datatypes: Array, Pointers, Structures, Unions 1. Array: A sequence or collection of same type of variables is an array. 2. Pointers: A variable that stores address to other variable or points to some memory address. 3. Structures: A collection of related variables of same or different Datatypes. 4. Unions: Almost same as Structures but the memory allocation and syntax is different. 5. String: Collection of characters is called a string. There is no Datatype named String in C.
4 [FURTHER DESCRIPTION OF DERIVED DATATYPES WILL BE GIVEN LATER] Operators in C 1. Arithmetic Operators ( +, -, *, /, %, ++, - -) 2. Logical Operators (&&,,!) 3. Relational Operators (==,!=, >, <, >=, <=) 4. Bitwise Operators ( &,, ^, ~, <<, >> ) 5. Assignment Operators (=, +=, -=, *=, /=, %=, <<=, >>=, &=, ^=, = ) 6. Unary Operators ( ~,!, ++, --, sizeof(), &,*) Here; & address of operator * pointer to a variable Control Statements 1. Decision Control Statements (if, if-else, switch, Ternary) 2. Looping Statements (while, do while, for) 3. Loop Control Statements (Break, continue, goto) 1. Condition Control Statements a. If b. If-else c. Switch d. Ternary IF STATEMENT IN C Suppose you want to find whether a number is even or odd. All you need to do is put a condition to check for even or odd number and print The message Number is Even if condition is true, else print message- Number is odd For a number to be even it is checked if it is divisible by 2 or not
5 Let the number be int a; then (a%2==0) means that number is divisible by 2 i.e. it is even Day 1: Program #4: Program for finding whether a number is even or odd in c will be: #include<stdio.h> int a; // Declaration of a variable. printf( enter a number ); scanf( %d,&a) // Scanf is used to input a number from user and this number is stored in variable a if(a%2==0) printf( Number is even ); else printf( number is odd ); More examples of if: Question: If users favourite color is Blue then Print You are cool #include<stdio.h> char *color; // pointer is used for string type of input. printf( Enter your favourite colour ); scanf( %s,color); // in pointer &(address of) operator is not used; if(color== Blue ) printf( You are cool ); Note: Now A condition above can arise that input (user s favourite colour is neither blue or Black then comes the use of if-else. If user s choice is Blue,then print You are cool OTHERWISE print You have a bad choice. #include<stdio.h> char *color; printf( Enter a color of you choice ); scanf( %s,color); //%s format specifier for string. if(color== Blue ) printf( You are cool ); else printf( You have bad choice );
6 Nested if-else Syntax: if (condition1) Statement 1; if(condition2) Statement2; else if(condition3) Statement3; Switch Statement in C Switch Statement is almost same as nested if and also provides better readability and handling. Switch statement is used with the break statement to break the continuity of the cases. Syntax: switch( case ) case 1: Statement 1; break; case 2: Statement 2; break; case 3: Statement 3; break; default: Statement 4; When none of the case is matched then the statements written in default are executed. If the case 2 should not get executed after case 1 then Break should be used between them. Example: Write a program to accept the name of a user. If the user name starts with a vowel then print You are Unique else print Welcome. #include<stdio.h> char *name, ch; // ch is a variable that will be used to store the first character in the username printf( Enter You name ); scanf( %s,name); ch=name[0]; //this stores the first character(index zero ) of name to variable ch switch( ch )
7 case a : case e : case i : case o;: case u : printf( You are Unique ); break; default: printf( Welcome ); If name = aryan. Then ch will store a (name[0]). Switch will jump to case a and then go through all cases e, i, o, u and print the message You are unique. However you can print the name in case a but since you have to print the same Message for all the 5 cases thus you can avoid break statement and write the message in the last case as eventually the last case will be reached and statements residing in that will be executed. Ternary operator in C Again a condition control statement and an alternate to if else this is used for mainly single if else however ternary can also be nested. Syntax: (condition)? (St1 if true) : (St2 If false) Example: Lets consider the same example of odd or even number. Let a be a number. Then, to check and print the number what we do is: 2. Looping Statements: (a%2==0)? printf( Even ) : printf( Odd ) ; (a%2==0) condition printf( Even ) true printf( Odd ) false FOR LOOP This is the most commonly used looping statement in any language as it is used when number of iterations is known to us. Syntax: for (initialisation; condition; updation) Statement 1; Statement 2; Example: Write a program for find the sum of first n natural numbers. (level: beginners) Solution: Now since the iteration is known : initialise i=-1; condition: uptill n i <= n (because we need n numbers) updation: i=i+1; we will have 1,2,3,4,5,6...n
8 IMP: Now decide what do you want to do with this iteration: (1,2,3,4,5...n) 1. You can print the values generated by i ( will result in printing the series 1,2,3...) 2. You can sum up the values of i (will result in Sum=sum+i; ) 3. Anything else which can be done by this type of iteration with your logics. 4. Here i is called loop variable. So, int i, n; // You need two variables one for running the loop and other // Accept the value of n from user... scanf( %d,&n); for(i=0;i<n;i++) printf( %d, i ); // this will print the series n return 0; Day 1: Program #5: Write a program to print the sum of n odd numbers, where n is given by user. Important: Observe the logic implemented here carefully. There are 2 solutions provided. Solution 1: int i,sum=0,n; scanf( %d,&n); for(i=1;i<2*n;i=i+2) // This is your logic, you can have you own logic. sum=sum+i; printf( sum of first n odd numbers is= %d,sum); return 0; Solution 2: return 0; // In this the loop variables i goes 1,2,3,4,5... int i, sum=0,n,k=1; thus you have to use different variable for scanf( %d,&n); finding odd number series and its sum for(i=1;i<=n;i++) sum=sum+k; k=k+2; //Thus k goes 1,3,5,7,9... which was done by variable i in Sol. 1
9 Array in C Array in c is a collection of same type of variables. Suppose you have to store 10 integer values then you need 10 variables, to overcome this situation arrays are used in which you can store 10 different values and denote them with a single variable name. A = A[0] A[1] A[2] A[3] A[4] A[5] Here, A[] is an array that contains 6 elements and the first element A[0] is 10. The indexing can start from 0, 1 or any number upto depending upon the size of array. SYNTAX: Datatype ArrayName[size]; Example: int A[10]; Thus A[] array can have maximum of 10 elements. However this method of declaration wastes a lot of memory as it allocates the space of 10 elements here- 20 Bytes (as each element is of 2 bytes:int), Thus Dynamic memory allocation is used which is much efficient as it allocates that memory which is required and the memory unused is freed. Also the memory can be increased or decreased later. You will study more about Dynamic memory allocation in c later. Day1: Program #4: Write a program to print the numbers stored in an array given by a user. Directions: 1. So, first you will store the numbers given by user in an array. 2. Then you will print them using a looping statement- for or while Solution: #include <stdio.h> int array[10],n,i; //where array[10] can store 10 elements and n is used for No. of elements. printf( enter the number of values you want to store: ); scanf( %d,&n); for(i=0;i<n;i++) scanf( %d,&array[i]); //this will store the user given element at i th position of the array. //loop for printing the elements for(i=0;i<n;i++) //there is no need to use brackets since loop contains only 1 statement printf( %d,array[i]); return 0;
10 Types of Array: 1. One Dimensional Array 2. Double Dimension Array 3. Multi Dimensional Array Multi dimensional array are those with multiple rows and multiple column. Ex. Two dimensional arrays, three dimensional arrays, matrices Single Dimension Array Array having one row and multiple column or assume vice-versa; int arr[10]; for(i=0;i<10;i++) scanf( %d,&arr[i]); //thus number given by user as input will be saved at i th index of array arr[]; Double Dimension Array A double dimensional array is a m x n array where: m number of rows n number of columns Thus, m x n array can be stored using a nested for loop. (While loop can also be used but it is inconvenient since number of iterations is known to us so it s better to use for loop. Read: Difference between while and for loop). The first for loop is for rows and the second for loop is for columns. Here We will often use the word MATRIX instead of double dimension array as its one and the same thing. //Program to accept a double dimensional array int arr[20][20], i, j, m, n; // Ask the user for the size of MATRIX or Double Dimension array printf( Enter the number of rows in a matrix ); scanf( %d,&m); printf( Enter the number of columns in matrix ); scanf( %d,&n); for(i=0;i<m;i++) for(j=0;j<n;j++) scanf( %d,&arr[i][j]); Same way you can print the double dimension array // program to print the double dimensional array
11 for(i=0;i<m;i++) for(j=0;j<n;j++) printf( %d,arr[i][j]); printf( \n ); The above \n escape sequence is used to change the line as soon as all the n elements of a row are printed to come to next row. This is a very common mistake not using \n during printing FURTHER TUTORIALS COMING SOON
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 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 informationFirst of all, it is a variable, just like other variables you studied
Pointers: Basics What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the address (rather than the value)
More informationUnit 3 Decision making, Looping and Arrays
Unit 3 Decision making, Looping and Arrays Decision Making During programming, we have a number of situations where we may have to change the order of execution of statements based on certain conditions.
More informationIntroduction to C. Systems Programming Concepts
Introduction to C Systems Programming Concepts Introduction to C A simple C Program Variable Declarations printf ( ) Compiling and Running a C Program Sizeof Program #include What is True in C? if example
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 informationDETAILED 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 informationDecision Making -Branching. Class Incharge: S. Sasirekha
Decision Making -Branching Class Incharge: S. Sasirekha Branching The C language programs presented until now follows a sequential form of execution of statements. Many times it is required to alter the
More informationSubject: 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 informationIV 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 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 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 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 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 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 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 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 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 informationUNIT - 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 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 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 informationC Syntax Out: 15 September, 1995
Burt Rosenberg Math 220/317: Programming II/Data Structures 1 C Syntax Out: 15 September, 1995 Constants. Integer such as 1, 0, 14, 0x0A. Characters such as A, B, \0. Strings such as "Hello World!\n",
More informationQ1. Multiple Choice Questions
Rayat Shikshan Sanstha s S. M. Joshi College, Hadapsar Pune-28 F.Y.B.C.A(Science) Basic C Programing QUESTION BANK Q1. Multiple Choice Questions 1. Diagramatic or symbolic representation of an algorithm
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 informationQuestions 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 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 informationComputer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];
Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data
More informationAryan 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 informationPrinciples of Programming. Chapter 6: Arrays
Chapter 6: Arrays In this chapter, you will learn about Introduction to Array Array declaration Array initialization Assigning values to array elements Reading values from array elements Simple Searching
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 informationC Programming Review CSC 4320/6320
C Programming Review CSC 4320/6320 Overview Introduction C program Structure Keywords & C Types Input & Output Arrays Functions Pointers Structures LinkedList Dynamic Memory Allocation Macro Compile &
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 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 informationFloating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions
Announcements Thursday Extras: CS Commons on Thursdays @ 4:00 pm but none next week No office hours next week Monday or Tuesday Reflections: when to use if/switch statements for/while statements Floating-point
More informationIntroduction to the C Programming Language
Introduction to the C Programming Language Michael Griffiths Corporate Information and Computing Services The University of Sheffield Email m.griffiths@sheffield.ac.uk Course Outline Part 1 Introduction
More informationChapter 2 (Dynamic variable (i.e. pointer), Static variable)
Chapter 2 (Dynamic variable (i.e. pointer), Static variable) August_04 A2. Identify and explain the error in the program below. [4] #include int *pptr; void fun1() { int num; num=25; pptr= #
More informationIntroduction to C Language (M3-R )
Introduction to C Language (M3-R4-01-18) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in OMR answer sheet supplied with the question paper, following
More informationQUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:
QUIZ 1. Explain the meaning of the angle brackets in the declaration of v below: This is a template, used for generic programming! QUIZ 2. Why is the vector class called a container? 3. Explain how the
More informationPrinciples of C and Memory Management
COMP281 Lecture 8 Principles of C and Memory Management Dr Lei Shi Last Lecture Pointer Basics Previous Lectures Arrays, Arithmetic, Functions Last Lecture Pointer Basics Previous Lectures Arrays, Arithmetic,
More informationIntroduction. C provides two styles of flow control:
Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if
More informationProgramming, numerics and optimization
Programming, numerics and optimization Lecture A-2: Programming basics II Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428 March
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 informationGovernment Polytechnic Muzaffarpur.
Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking
More informationProcedures, Parameters, Values and Variables. Steven R. Bagley
Procedures, Parameters, Values and Variables Steven R. Bagley Recap A Program is a sequence of statements (instructions) Statements executed one-by-one in order Unless it is changed by the programmer e.g.
More informationMCA Semester 1. MC0061 Computer Programming C Language 4 Credits Assignment: Set 1 (40 Marks)
Summer 2012 MCA Semester 1 4 Credits Assignment: Set 1 (40 Marks) Q1. Explain the following operators with an example for each: a. Conditional Operators b. Bitwise Operators c. gets() and puts() function
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 informationM1-R4: Programing and Problem Solving using C (JAN 2019)
M1-R4: Programing and Problem Solving using C (JAN 2019) Max Marks: 100 M1-R4-07-18 DURATION: 03 Hrs 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter
More informationFlow Chart. The diagrammatic representation shows a solution to a given problem.
low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation
More informationCS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010
CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please
More informationComputers 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 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 informationFeatures 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 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 informationCS 61C: Great Ideas in Computer Architecture Introduction to C
CS 61C: Great Ideas in Computer Architecture Introduction to C Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/ 1 Agenda C vs. Java vs. Python Quick Start Introduction
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 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 informationRecap. 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 informationQ 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 informationFundamental 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 informationSchool of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15
Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL
More informationC 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 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 informationComputer 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 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 informationLaboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information
Laboratory 2: Programming Basics and Variables Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information 3. Comment: a. name your program with extension.c b. use o option to specify
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 informationCreating a C++ Program
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer. 1 Creating a C++ Program created using an
More informationARRAYS(II Unit Part II)
ARRAYS(II Unit Part II) Array: An array is a collection of two or more adjacent cells of similar type. Each cell in an array is called as array element. Each array should be identified with a meaningful
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 informationM3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE
M3-R4: 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 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 informationI 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 informationCSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community
CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu History and Evolution of Programming Languages 1. Explain the relationship between machine
More informationYacoub Sabatin Muntaser Abulafi Omar Qaraeen
Programming Fundamentals for Engineers - 0702113 6. Arrays Yacoub Sabatin Muntaser Abulafi Omar Qaraeen 1 One-Dimensional Arrays There are times when we need to store a complete list of numbers or other
More informationBasic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island
Basic C Programming (2) Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island Data Types Basic Types Enumerated types The type void Derived types
More informationA 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 informationAPSC 160 Review. CPSC 259: Data Structures and Algorithms for Electrical Engineers. Hassan Khosravi Borrowing many questions from Ed Knorr
CPSC 259: Data Structures and Algorithms for Electrical Engineers APSC 160 Review Hassan Khosravi Borrowing many questions from Ed Knorr CPSC 259 Pointers Page 1 Learning Goal Briefly review some key programming
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 informationDynamic Memory Allocation
Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility, there are four library routines known as memory management
More informationadvanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef
today advanced data types (1) typedef. mon 23 sep 2002 homework #1 due today homework #2 out today quiz #1 next class 30-45 minutes long one page of notes topics: C advanced data types dynamic memory allocation
More informationTechnical Questions. Q 1) What are the key features in C programming language?
Technical Questions Q 1) What are the key features in C programming language? Portability Platform independent language. Modularity Possibility to break down large programs into small modules. Flexibility
More informationReview 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 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 informationProgramming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 04 Programs with IO and Loop We will now discuss the module 2,
More informationCSCI 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 informationVALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR
VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and
More informationProgramming & Data Structure Laboratory. Arrays, pointers and recursion Day 5, August 5, 2014
Programming & Data Structure Laboratory rrays, pointers and recursion Day 5, ugust 5, 2014 Pointers and Multidimensional rray Function and Recursion Counting function calls in Fibonacci #include
More informationVariation of Pointers
Variation of Pointers A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #43 Multidimensional Arrays In this video will look at multi-dimensional arrays. (Refer Slide Time: 00:03) In
More informationCOMPUTER APPLICATION
Total No. of Printed Pages 16 HS/XII/A.Sc.Com/CAP/14 2 0 1 4 COMPUTER APPLICATION ( Science / Arts / Commerce ) ( Theory ) Full Marks : 70 Time : 3 hours The figures in the margin indicate full marks for
More information'C' Programming Language
F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax
More informationC Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,
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 informationC 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 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 informationArrays and Pointers in C. Alan L. Cox
Arrays and Pointers in C Alan L. Cox alc@rice.edu Objectives Be able to use arrays, pointers, and strings in C programs Be able to explain the representation of these data types at the machine level, including
More informationData Type Fall 2014 Jinkyu Jeong
Data Type Fall 2014 Jinkyu Jeong (jinkyu@skku.edu) 1 Syntax Rules Recap. keywords break double if sizeof void case else int static... Identifiers not#me scanf 123th printf _id so_am_i gedd007 Constants
More informationET156 Introduction to C Programming
ET156 Introduction to C Programming Unit 1 INTRODUCTION TO C PROGRAMMING: THE C COMPILER, VARIABLES, MEMORY, INPUT, AND OUTPUT Instructor : Stan Kong Email : skong@itt tech.edutech.edu Figure 1.3 Components
More informationContent. In this chapter, you will learn:
ARRAYS & HEAP Content In this chapter, you will learn: To introduce the array data structure To understand the use of arrays To understand how to define an array, initialize an array and refer to individual
More informationArrays. Example: Run the below program, it will crash in Windows (TurboC Compiler)
1 Arrays General Questions 1. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array? A. The element will be set to 0. B. The compiler would
More information