Consider the following C++ codes: Code a: Code b: int x-8; // global void func () int x-8; // global int age-18; // global void func () int age-18; cout<<"X is: "<
Consider the following C++ codes: Code a: Code b: int x-8; // global void func () int x-8; // global int age-18; // global void func () int age-18; cout<<"X is: "<
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 1PE
Related questions
Question
![Consider the following C++ codes:
Code a:
Code b:
int x 8; // global
void func ()
int x 8; // global
int age=18; // global
void func ()
{
int age=18;
cout<<"X is: "<<x;
cout<<"age is: "<<age;
{
cout<<"X is: "<<x;
cout<<"age is: "<<age;
int main ()
int main ()
{
int x-18;
{
cout<<"x is: "<<x;
cout<<"x is: "<<x;
return 0;
return 0;
Where cout is used to display the output to the standard output device. For each part of
code, specify if x and age are local or global for main and func().](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa232bb5c-8eb5-4398-823e-ef7d8bf77344%2Fb20a3b7a-d8f8-4cdc-ae93-11208b9eb1b2%2Fkgl4f0v_processed.png&w=3840&q=75)
Transcribed Image Text:Consider the following C++ codes:
Code a:
Code b:
int x 8; // global
void func ()
int x 8; // global
int age=18; // global
void func ()
{
int age=18;
cout<<"X is: "<<x;
cout<<"age is: "<<age;
{
cout<<"X is: "<<x;
cout<<"age is: "<<age;
int main ()
int main ()
{
int x-18;
{
cout<<"x is: "<<x;
cout<<"x is: "<<x;
return 0;
return 0;
Where cout is used to display the output to the standard output device. For each part of
code, specify if x and age are local or global for main and func().
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr