The document discusses scoping in programming languages. There are two types of scoping: static scoping and dynamic scoping. Static scoping determines variable visibility based on the block structure, while dynamic scoping searches calling functions to determine variable visibility. Scoping is important for reusing variable names, modularity, and avoiding conflicts between variables defined in different parts of a program.
Virtual Functions support dynamic binding and object-oriented programming. A class that declares or inherits a virtual function is called a polymorphic class.
Virtual Functions support dynamic binding and object-oriented programming. A class that declares or inherits a virtual function is called a polymorphic class.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019corehard_by
LLVM содержит огромное количество оптимизаций и подходит в качестве бэкенда для многих языков программирования. Но все немного усложняется для Managed языков и JIT сценариев. В этом докладе Егор расскажет о трудностях, с которыми столкнулись в C# при реализации LLVM бэкенда.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019corehard_by
LLVM содержит огромное количество оптимизаций и подходит в качестве бэкенда для многих языков программирования. Но все немного усложняется для Managed языков и JIT сценариев. В этом докладе Егор расскажет о трудностях, с которыми столкнулись в C# при реализации LLVM бэкенда.
The following is the (incomplete) header file for the class Fracti.pdf4babies2010
The following comparative income statement (in thousands of dollars) for the two recent fiscal
years was adapted from the annual report of Speedway Motorsports, Inc., owner and operator of
several major motor speedways, such as the Atlanta, Texas, and Las Vegas Motor Speedways.
Current Year Previous Year 2 Revenues: 3 Admissions 4Event-related revenue $104,312.00
$116,644.00 131,164.00 170,368.00 65,824.00 $472,000.00 $484,000.00 42,544.00 180,304.00
44,840.00 NASCAR broadcasting revenue Other operating revenue 7 Total revenue 8 Expenses
and other: 9 Direct expense of events 10 NASCAR purse and sanction fees 91,568.00
$101,640.00 117,612.00 20,328.00 220,220.00 424800.00 $459,800.00 $24,200.00 118,000.00
19,352.00 195,880.00 11 Other direct expenses 2 General and administrative 13 Total expenses
and other Income from continuing operations $47,200.00 14 Required A. Prepare a comparative
income statement for these two years in vertical form, stating each item as a percent of revenues.
Enter all amounts as positive numbers. Rounding instructions
Solution
VERTICAL ANALYSIS OF INCOME STATEMENT Particulars Current Year
Amount Current Year Percentage Previous Year Amount Previous Year Percentage
Admissions $ 1,04,312.00 22.10% $ 1,16,644.00 24.10% Event Related revenue $ 1,42,544.00
30.20% $ 1,31,164.00 27.10% NASCAR Broadcasting Revenue $ 1,80,304.00 38.20% $
1,70,368.00 35.20% Other Operating Income $ 44,840.00 9.50% $ 65,824.00 13.60%
Total Revenue $ 4,72,000.00 100.00% $ 4,84,000.00 100.00% Expenses and others
Direct expenses of events $ 91,568.00 19.40% $ 1,01,640.00 21.00% NASCAR purse and
sanction fees $ 1,18,000.00 25.00% $ 1,17,612.00 24.30% Other direct expenses $ 19,352.00
4.10% $ 20,328.00 4.20% General and adminstrative $ 1,95,880.00 41.50% $ 2,20,220.00
45.50% Total Expenses and others $ 4,24,800.00 90.00% $ 4,59,800.00 95.00% Income
from continuing operation $ 47,200.00 10.00% $ 24,200.00 5.00%.
I am telling about basic c such as variable,constant,operators,decison making,loops,switch,break and continue,function,call by value ,call by reference and recursion.In this pdf i give some practice problems too.
This contains all the slides used in Silicon Valley Code Camp presentation on Sunday Oct 4, 10:45 session on "Amazing new features in JavaScript". At the end ut also includes the last year presentation covering ES 5
PROGRAM 2 – Fraction Class Problem For this programming as.pdfezonesolutions
PROGRAM 2 – Fraction Class
Problem For this programming assignment, you are to implement the Fraction class design
given below (and discussed in class). You are also to develop an appropriate test driver that
thoroughly tests the class.
Fraction Class Design Implement the following class design. Make sure to use implement the
methods to have the same names as given below, with the same number and types of parameters.
public class Fraction {
private int numer;
private int denom;
// alternate constructor
public Fraction(int numer, int denom)
throws InvalidDenominatorException {
}
// copy constructor
public Fraction(Fraction otherFrac) {
}
// getters
public int getNumer() {
}
public int getDenom() {
}
// standard methods
public String toString() {
}
public boolean equals(Fraction rFrac) {
}
// fraction operators
public Fraction add(Fraction rFrac) {
}
public Fraction sub(Fraction rFrac) {
}
public Fraction mult(Fraction rFrac) {
}
public Fraction div(Fraction rFrac) {
}
public boolean isSimplestForm() {
}
public Fraction reduce() {
}
public boolean properFrac() {
}
public Fraction abs() {
}
public boolean lessThan(Fraction rFrac) {
}
public boolean greaterThan(Fraction rFrac) {
}
public double convertToDecimal() {
}
public Fraction invert() {
}
}
Note that objects of type Fraction are immutable. Also, the alternate constructor throws an
InvalidDenominatorException if passed a denominator value of 0. This exception type is not
predefined in Java, so you must define it as follow as another class in your Java project files:
public class InvalidDenominatorException extends RuntimeException { } // nothing to
implement
This creates an exception of type RuntimeException. RuntimeExceptions do not need to be
caught when thrown. However, your test driver should have the code for catching this exception
where appropriate.
For example, if your test driver excutes the following,
Fraction frac1 = new Fraction(1,2);
then there is no need to catch the possible exception, since it is clear that the denominator is not
0. However, if the value are input by the user, then there is a chance that a denominator vaue of 0
could be entered, and therefore the code for catching the possible exception is needed,
int numer, denom;
Fraction frac1;
Scanner input = new Scanner(System.in);
Boolean valid_input = false;
while (!valid_input) try {
System.out.print(“Enter numerator denominator: “);
numer = input.nextInt();
denom = input.nextInt();
frac1 = new Fraction(numer,denom);
valid_input = true;
}
catch (InvalidDenominatorException e) {
System.out.println(“Denominator of Zero found – Please reenter”);
}
catch (InputMismatchException e) {
System.out.println(“Non-digit character found – Please reenter”);
} etc.
Considerations
Makes sure the equals method returns true for any two fractions that are arithmetically equal.
Make sure that the equals, lessThan and greaterThan methods do not alter the values of the
fractions being compared. You may consider the use of private methods .
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
Do you want Software for your Business? Visit Deuglo
Deuglo has top Software Developers in India. They are experts in software development and help design and create custom Software solutions.
Deuglo follows seven steps methods for delivering their services to their customers. They called it the Software development life cycle process (SDLC).
Requirement — Collecting the Requirements is the first Phase in the SSLC process.
Feasibility Study — after completing the requirement process they move to the design phase.
Design — in this phase, they start designing the software.
Coding — when designing is completed, the developers start coding for the software.
Testing — in this phase when the coding of the software is done the testing team will start testing.
Installation — after completion of testing, the application opens to the live server and launches!
Maintenance — after completing the software development, customers start using the software.
Launch Your Streaming Platforms in MinutesRoshan Dwivedi
The claim of launching a streaming platform in minutes might be a bit of an exaggeration, but there are services that can significantly streamline the process. Here's a breakdown:
Pros of Speedy Streaming Platform Launch Services:
No coding required: These services often use drag-and-drop interfaces or pre-built templates, eliminating the need for programming knowledge.
Faster setup: Compared to building from scratch, these platforms can get you up and running much quicker.
All-in-one solutions: Many services offer features like content management systems (CMS), video players, and monetization tools, reducing the need for multiple integrations.
Things to Consider:
Limited customization: These platforms may offer less flexibility in design and functionality compared to custom-built solutions.
Scalability: As your audience grows, you might need to upgrade to a more robust platform or encounter limitations with the "quick launch" option.
Features: Carefully evaluate which features are included and if they meet your specific needs (e.g., live streaming, subscription options).
Examples of Services for Launching Streaming Platforms:
Muvi [muvi com]
Uscreen [usencreen tv]
Alternatives to Consider:
Existing Streaming platforms: Platforms like YouTube or Twitch might be suitable for basic streaming needs, though monetization options might be limited.
Custom Development: While more time-consuming, custom development offers the most control and flexibility for your platform.
Overall, launching a streaming platform in minutes might not be entirely realistic, but these services can significantly speed up the process compared to building from scratch. Carefully consider your needs and budget when choosing the best option for you.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Transform Your Communication with Cloud-Based IVR SolutionsTheSMSPoint
Discover the power of Cloud-Based IVR Solutions to streamline communication processes. Embrace scalability and cost-efficiency while enhancing customer experiences with features like automated call routing and voice recognition. Accessible from anywhere, these solutions integrate seamlessly with existing systems, providing real-time analytics for continuous improvement. Revolutionize your communication strategy today with Cloud-Based IVR Solutions. Learn more at: https://thesmspoint.com/channel/cloud-telephony
Utilocate offers a comprehensive solution for locate ticket management by automating and streamlining the entire process. By integrating with Geospatial Information Systems (GIS), it provides accurate mapping and visualization of utility locations, enhancing decision-making and reducing the risk of errors. The system's advanced data analytics tools help identify trends, predict potential issues, and optimize resource allocation, making the locate ticket management process smarter and more efficient. Additionally, automated ticket management ensures consistency and reduces human error, while real-time notifications keep all relevant personnel informed and ready to respond promptly.
The system's ability to streamline workflows and automate ticket routing significantly reduces the time taken to process each ticket, making the process faster and more efficient. Mobile access allows field technicians to update ticket information on the go, ensuring that the latest information is always available and accelerating the locate process. Overall, Utilocate not only enhances the efficiency and accuracy of locate ticket management but also improves safety by minimizing the risk of utility damage through precise and timely locates.
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Łukasz Chruściel
No one wants their application to drag like a car stuck in the slow lane! Yet it’s all too common to encounter bumpy, pothole-filled solutions that slow the speed of any application. Symfony apps are not an exception.
In this talk, I will take you for a spin around the performance racetrack. We’ll explore common pitfalls - those hidden potholes on your application that can cause unexpected slowdowns. Learn how to spot these performance bumps early, and more importantly, how to navigate around them to keep your application running at top speed.
We will focus in particular on tuning your engine at the application level, making the right adjustments to ensure that your system responds like a well-oiled, high-performance race car.
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Graspan: A Big Data System for Big Code AnalysisAftab Hussain
We built a disk-based parallel graph system, Graspan, that uses a novel edge-pair centric computation model to compute dynamic transitive closures on very large program graphs.
We implement context-sensitive pointer/alias and dataflow analyses on Graspan. An evaluation of these analyses on large codebases such as Linux shows that their Graspan implementations scale to millions of lines of code and are much simpler than their original implementations.
These analyses were used to augment the existing checkers; these augmented checkers found 132 new NULL pointer bugs and 1308 unnecessary NULL tests in Linux 4.4.0-rc5, PostgreSQL 8.3.9, and Apache httpd 2.2.18.
- Accepted in ASPLOS ‘17, Xi’an, China.
- Featured in the tutorial, Systemized Program Analyses: A Big Data Perspective on Static Analysis Scalability, ASPLOS ‘17.
- Invited for presentation at SoCal PLS ‘16.
- Invited for poster presentation at PLDI SRC ‘16.
OpenMetadata Community Meeting - 5th June 2024OpenMetadata
The OpenMetadata Community Meeting was held on June 5th, 2024. In this meeting, we discussed about the data quality capabilities that are integrated with the Incident Manager, providing a complete solution to handle your data observability needs. Watch the end-to-end demo of the data quality features.
* How to run your own data quality framework
* What is the performance impact of running data quality frameworks
* How to run the test cases in your own ETL pipelines
* How the Incident Manager is integrated
* Get notified with alerts when test cases fail
Watch the meeting recording here - https://www.youtube.com/watch?v=UbNOje0kf6E
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppGoogle
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-fusion-buddy-review
AI Fusion Buddy Review: Key Features
✅Create Stunning AI App Suite Fully Powered By Google's Latest AI technology, Gemini
✅Use Gemini to Build high-converting Converting Sales Video Scripts, ad copies, Trending Articles, blogs, etc.100% unique!
✅Create Ultra-HD graphics with a single keyword or phrase that commands 10x eyeballs!
✅Fully automated AI articles bulk generation!
✅Auto-post or schedule stunning AI content across all your accounts at once—WordPress, Facebook, LinkedIn, Blogger, and more.
✅With one keyword or URL, generate complete websites, landing pages, and more…
✅Automatically create & sell AI content, graphics, websites, landing pages, & all that gets you paid non-stop 24*7.
✅Pre-built High-Converting 100+ website Templates and 2000+ graphic templates logos, banners, and thumbnail images in Trending Niches.
✅Say goodbye to wasting time logging into multiple Chat GPT & AI Apps once & for all!
✅Save over $5000 per year and kick out dependency on third parties completely!
✅Brand New App: Not available anywhere else!
✅ Beginner-friendly!
✅ZERO upfront cost or any extra expenses
✅Risk-Free: 30-Day Money-Back Guarantee!
✅Commercial License included!
See My Other Reviews Article:
(1) AI Genie Review: https://sumonreview.com/ai-genie-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
#AIFusionBuddyReview,
#AIFusionBuddyFeatures,
#AIFusionBuddyPricing,
#AIFusionBuddyProsandCons,
#AIFusionBuddyTutorial,
#AIFusionBuddyUserExperience
#AIFusionBuddyforBeginners,
#AIFusionBuddyBenefits,
#AIFusionBuddyComparison,
#AIFusionBuddyInstallation,
#AIFusionBuddyRefundPolicy,
#AIFusionBuddyDemo,
#AIFusionBuddyMaintenanceFees,
#AIFusionBuddyNewbieFriendly,
#WhatIsAIFusionBuddy?,
#HowDoesAIFusionBuddyWorks
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Concept of scoping in programming languages
1. Concept of Scoping in
Programming Languages
Mohammed Jafar Sadik
ID-1620660042
Dept. of ECE, NSU
2. What Is Scoping?
▪ Scope refers to the visibility of variables. In other words, which parts
of your program can see or use it. Normally, every variable has a
global scope. Once defined, every part of your program can access
the variable.
3. Why Scoping?
▪ In General, Scoping is necessary if you want to reuse variable names
▪ Example:
int fn1()
{
int a =10;
}
int fn2()
{
int a=20;
} //We are using same variable in two different functions.
4. Why Scoping? (Contd.)
▪ Scoping rules are crucial in modular programming, so a change in one part of program
does not break an unrelated part.
▪ Example: Imagine you are a project manager in a software company, you have 10
developers working on your project.You divided the work in 10 parts, let’s assume they
are working on 10 different Java classes.They are defining the variables by their own.
They don’t even know if the variable they are defining, are being defined or has been
defined by other developers in other classes too.They shouldn’t even have to worry
about that too. Because the SCOPING of the variables are helping that they’ll work
only in their class and will not effect other or upper tier functionalities.
▪HOW IS IT POSSIBLE???
5. Why Scoping (contd.)
▪ A class defined by developer1:
public class Dog
{ String breed, int age, String
color;
void barking() { // }
void hungry() { // }
void sleeping() { // }
}
▪ A class defined by developer2:
public class Cat
{ String breed, int age, String
color;
void meaowing() { // }
void hungry() { // }
void sleeping() { // }
}
**Here two different developers defining two different classes with same variable
names.They shouldn’t be worried about this.Though they are working on the
same project but their variable scope is limited within their own class.
6. Types of Scoping…
▪ There are two types of Scoping:
1. Static Scoping or Lexical Scoping
2. Dynamic Scoping
7. Static or Lexical Scoping
▪ In Static scoping, definition of a variable is resolved by searching its containing block or function. If
that fails, then searching the outer containing block and so on. Let’s consider an example:
int a=10, b=20;
int fnc()
{ int a =5;
if(condition)
{
int c;
c=b/a;
printf(“%d”,c);
}
} //OUTPUT: 20/5=4
8. Static scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to the
global variable a*/
return c; //5+20=25, return 25
}
9. Static scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to the
global variable a*/
return c; //5+20=25, return 25
}
//b=25
now
10. Static scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to the
global variable a*/
return c; //5+20=25, return 25
}
//b=25
now
//a=25
11. Static scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to the
global variable a*/
return c; //5+20=25, return 25
}
//b=25
now
//a=25
Final output:25
12. ▪ In dynamic scoping, definition of a variable is resolved by searching its containing block and if not found, then
searching its calling function and if still not found then the function which called that calling function will be
searched and so on…
int x=5;
int fn1() int fn3()
{ int x =10; {
fn2(); fn4(); will search for variable x in fn4(), not found.
} } will search for variable x in the function that
int fn2() int fn4() called the fn4(), which is fn3(), no x in fn3(),
will search for x in the function that called fn3(),
{ { which is fn2(), not found, will search for x in the
fn3(); printf(“%d”, x); function which called fn2(), which is fn1(), in fn1()
} } we have variable x=10, output=10; but in case of
static scoping the output would be 5
Dynamic scoping…
13. Dynamic scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to
the calling function of fun2(), which is fun1(), no variable
named a, now will go to the calling function of fun1(), which
is main(). main() has the variable a, which is = 10*/
return c; //10+20=30, return 30
}
14. Dynamic scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to
the calling function of fun2(), which is fun1(), no variable
named a, now will go to the calling function of fun1(), which
is main(). main() has the variable a, which is = 10*/
return c; //10+20=30, return 30
}
//b=30
now
15. Dynamic scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to
the calling function of fun2(), which is fun1(), no variable
named a, now will go to the calling function of fun1(), which
is main(). main() has the variable a, which is = 10*/
return c; //10+20=30, return 30
}
//b=30
now
//a=30
16. Dynamic scoping in depth…
int fun1(int);
int fun2(int);
int a=5;
int main()
{
int a =10;
a=fun1(a);//calling the fun1, so we will jump into it
printf(“%d”, a);
}
int fun1(int b) //b=10
{
b=b+10; //b=20 here
b=fun2(b) //calling the fun2, so we will jump into it.
return b;
}
int fun2(int b) //b=20
{
int c;
c= a+ b; /*b=20 here, but no values for a, so we will go to
the calling function of fun2(), which is fun1(), no variable
named a, now will go to the calling function of fun1(), which
is main(). main() has the variable a, which is = 10*/
return c; //10+20=30, return 30
}
//b=30
now
//a=30
output:30