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
Project Description: Seeking a Voting Bot Script / Program Skills required are ASP, Javascript, C Programming, PHP, Software Architecture

write a program to find the area under the curve y=f(x) between x=a and x=b integrate y=f(x)   #include float start_point, /* GLOBAL VARIABLES */

Define Static Storage Class in C Programming? The Static declarations have distinct and important uses. This allows the local variable to keep its previous value when the block

Aim: To implement a program to find area of rectangle, surface area of box and volume of box using virtual functions. Code:                       class rect {

Question: (a) Write down the class 'ListNode' to contain the following:- (i) variable data of type Object (ii) variable next of type ListNode (iii)


Write a C program to compute the value of a sine wave from 0 to 2P with an increment of 0.1 radians.   #include stdio.h #include math.h #define pi 3.1415927 void main() {   c

Structures A structure is a derived data type. It is a combination of logically related data items. Unlike arrays, which are a collection of such as data types, structures can

A: A reference has to always refer to some object and, so, must always be initialized; pointers do not have such limits. A pointer may be reassigned to point to distinct objects wh

Ask question #Minimum 100 words awhat is the pre condition for binary searching ccepted#