Create program to prints out the value of a variable, C/C++ Programming

Here is a short program. It prints out the value of a variable "x". Ernie and Bert disagree about what will be printed: Ernie says, the value gets changed in "changeX" so it will print "7", and Bert says, no, when the function exits the changes get reversed and the value goes back to "5". Explain who is correct and why.

int x = 5;

void draw()

{

   changeX();

   print(x);

}

voidchangeX()

{

   int x = 7;

}

 

 

Posted Date: 3/29/2013 2:03:11 AM | Location : United States







Related Discussions:- Create program to prints out the value of a variable, Assignment Help, Ask Question on Create program to prints out the value of a variable, Get Answer, Expert's Help, Create program to prints out the value of a variable Discussions

Write discussion on Create program to prints out the value of a variable
Your posts are moderated
Related Questions
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Programming Assignment # 1 C and UNIX   The purpose of this assignment is to get you more familiar with Unix/Linux and those constructs of C that are not part of C++. Write a C


can we use const data member in static. member function with example.

C++ improves on many of C's features and provides object-oriented programming capabilities used for software production, quality and reusability. C++ was developed by Bjarne Strons

.Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

The default Constructor and Destructor If you fail to write a constructor and destructor function,  the compiler automatically supplies them for you. These functions have publi

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Write a program which incorporates a function named compute and which is used to calculate the area and circumference of a circle. Use the main function for inputs and outputs.

Project Description: I want an app that the user can download it from the play store and use it as a keyboard for texts and writing. Just like the Samsung keyboard and the arabi