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
(a) Verify the values of the resistors with the following colour coding: (i) red-red-orange-silver (ii) orange-orange-black-blue-green (b) What is the value of a resistor

in this problem u given a board in which some of the elements are placed as shown in diagram below .each element represent a color .fill the other elements in the board such that n

I have a mini project where I need to write a code .wonder if someone can help me.I already have the forms and webmaster page done just need to code portion

Destructor: The purpose of destructor is to free the memory when the compiler memory is reduced or not enough to execute certain program. Sometimes there may several objects op

Description A long time ago in a galaxy far, far away, the country Mafghanistan had n cities and m old roads, where each road connected a pair of cities. Due to the treacherous mo

what is poiter

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

program for singly linked list with out header

c | c-c-c-c-c | c-c-C-c-c | c find distance between difftent carbon atom by programing

Unlike C++, other programming languages have associative arrays that allow array indices to be strings instead of just integers. You are to create a template class, SVector, that i