By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

Introduction to C Programming
1 Storage Duration and Scope –Local and global variables Storage classes –automatic, static, external, register Todays Material.
Chapter 10 Linking and Loading. Separate assembly creates “.mob” files.
Local Variables and Scope Benjamin Fein. Variable Scope A variable’s scope consists of all code blocks in which it is visible. A variable is considered.
Programming C/C++ on Eclipe Trình bày : Ths HungNM C/C++ Training.
Chapter 7: User-Defined Functions II
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 7: User-Defined Functions II.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Overview scope - determines when an identifier can be referenced in a program storage class - determines the period of time during which that identifier.
Chapter 16 Resources and the Environment at the Global Level.
Storage & Linkage: Effects on Scope Rudra Dutta CSC Spring 2007, Section 001.
Introduction to C++ Programming
Unit 2: Java Introduction to Programming 2.1 Initial Example.
CMPE-013/L: “C” Programming Gabriel Hugh Elkaim – Spring 2013 CMPE-013/L Modules and Scope Gabriel Hugh Elkaim Spring 2013.
CSCI 130 Scope of Variables Chapter 6. What is scope Parts of program which can access a variable –accessibility –visibility How long variable takes up.
chap13 Chapter 13 Programming in the Large.
Copyright 2001 Oxford Consulting, Ltd1 January Storage Classes, Scope and Linkage Overview Focus is on the structure of a C++ program with –Multiple.
C++ for Engineers and Scientists Second Edition Chapter 6 Modularity Using Functions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Functions Kernighan/Ritchie: Kelley/Pohl: Chapter 4 Chapter 5.
 2007 Pearson Education, Inc. All rights reserved Random Number Generation  rand function – Load – Returns "random" number between
Functions in C CSE 2451 Rong Shi. Functions Why use functions? – Reusability Same operation, different data – Abstraction Only need to know how to call.
DOCUMENTATION SECTION GLOBAL DECLARATION SECTION
Week 11 Multi-file Programs and Scope of Variables.
CITA 342 Section 1 Object Oriented Programming (OOP)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
+ Storage Classes and Linkage. + Introduction Scope describe the region or regions of a program that can access and identifier Variables can be shared.
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
JavaScript Modularity. Goals By the end of this lecture, you should … Understand why programmers use modularity. Understand how to create a function in.
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
 2006 Pearson Education, Inc. All rights reserved Templates.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
Classes and Objects C++ Programming Technologies.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.
Introduction to GCC Department of Radio Physics and Electronics ILug-Cal Introduction to GCC Department of Radio Physics and Electronics, Calcutta University.
Web Basics: HTML/CSS/JavaScript What are they?
Test 2 Review Outline.
Tools of the Trade
IBM Workload Scheduler
Variable Scope Variable, variable, who’s got the variable?
Introduction to C Programming Language
Elements of the PHP Programming Environment
C++ for Engineers and Scientists Second Edition
Using local variable without initialization is an error.
Tejalal Choudhary “C Programming from Scratch” Function & its types
The Boolean (logical) data type boolean
C Programming APP3o.
Scope (visibility) scope in C is simple:
HELLO THERE. THIS IS A TEST SLIDE SLIDE NUMBER 1.
CSC 253 Lecture 7.
Scope Rules and Storage Types
Seoul National University
Namespaces How Shall I Name Thee?.
Copyright © 2013 Elsevier Inc. All rights reserved.
C Programming Language
Troubleshooting Compiler Errors
Building Blocks of C Programming Language
Functions By Anand George.
Introduction to Windbg – Part2 Symbols
Seoul National University
C Programming Lecture-17 Storage Classes
Hello World Program In Visual Studio and Debugging
Presentation transcript:

by Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Introduction  Most of the real world programs contain more than 1 source code files.  This is for modularity and manage ability. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Demo  Multifile C hello world.  New header file creation. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Some practices  All declaration should be in the header files.  All definitions should be in the Source Files.  Declarations are things which complier look for.  Definitions are things which linker look for.  So normally header file and C files are pairs. Like mymodule1.h ( contains all the declarations of variables and functions) and mymodule.cpp ( contains all the definitions of variables and functions ) SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

keyword extern  For declaring global variable which are defined in other C files.  static keyword for file scope. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Demo  Declaration and definition distinguished.  Generation of complier error and link error.  Global variables and extern keyword.  static variable scope. SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)

Thank you SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)