Example of function - c program, 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/20/2013 5:23:45 AM | Location : United States







Related Discussions:- Example of function - c program, Assignment Help, Ask Question on Example of function - c program, Get Answer, Expert's Help, Example of function - c program Discussions

Write discussion on Example of function - c program
Your posts are moderated
Related Questions
Optimized NIC Driver for Windows Compact 7 for Hard Real Time Communication Project Description: I am seeking an optimized driver (miniport driver) that will be used for sele


Working Ordered linked list: • Eachinteger in the queue is stored inside of a QueueItem. The QueueItem contains the integer, and a pointer to the next item in the queue. Fo

I can''t figure out how to stop the programming from hitting for the player even when they type in stand.

Define Functions with arguments and no return values The calling function will read a data from the terminal and pass it on to called as function and this will work good as the

create a flowchart that display the assume that there are 3 section each student ?

First line starts with T, number of test cases. Each test case T contains a necklace (N).

P r i va t e Member Functions: A private member functions can be called by the members of the same class.  Consider the following example.   c l a ss sample

¦It should ask customers to enter details such as their names and addresses. ¦It should print a welcome message that includes the customer’s name. ¦It should provide a list of avai

within 2 mins give me answer pllzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz