Post Reply 
Local variables - C Style
11-07-2015, 12:48 PM
Post: #3
RE: Local variables - C Style
(11-07-2015 12:28 PM)Han Wrote:  
(11-07-2015 09:08 AM)alen12345 Wrote:  Dear users,

I have not fully understood the scope of local variables. I would like to create programs on the fly which store intermediate result in order to display them just before the end of the program. Something stupid like this one in C++:

Code:

#include <iostream>
using namespace std;
int main()
{
//Dati
    int a=2; int b=3;
//Risoluzione
    int c=a+b;
    int d=c*c;
    int f=c*c*c+d;
    cout<<"Risultato: "<<f<<endl;
    return 0;
}

Something that would not involve stack manipulation which would become rather difficult in longer programs.

Thanks in advance for your help.

What calculator are you using?

Sorry about that, I'm on a HP50G; I have also edited my first post.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Local variables - C Style - alen12345 - 11-07-2015, 09:08 AM
RE: Local variables - C Style - Han - 11-07-2015, 12:28 PM
RE: Local variables - C Style - alen12345 - 11-07-2015 12:48 PM
RE: Local variables - C Style - peacecalc - 11-07-2015, 01:41 PM
RE: Local variables - C Style - C.Ret - 11-08-2015, 02:52 PM
RE: Local variables - C Style - peacecalc - 11-08-2015, 07:28 PM



User(s) browsing this thread: 1 Guest(s)