java recursively achieve multi -level menu

2023-01-20   ES  

We know that in C ++, the storage area of global variables and local variables is different. The global variables are stored in static data areas and local variables are stored in the stack area. However, there is another small point that is stored in the static data area. The variables stored in the stack area are stored from high addresses to the low address. Static local variables and static global variables.

#include <iOSTREAM> 
 using namespace std; 
 int allval1 = 3, allval2 = 4; // global variables 
 Static int Sallval1 = 2, Sallval2 = 5; // Static global variables 
 main (main (main (main (main (main (main (main 
 {{ 
  Static int SVAL1 = 2, SVAL2 = 3; // Static local variables 
  int Val1 = 0, Val2 = 1; 
  COUT << "Storage order of global variables:" << endl; 
  COUT << "allval1:" << & allVal1 << "allval2:" << & allVal2 << endl; 
  COUT << "Storage order of static global variables:" << endl; 
  COUT << "Sallval1:" << & SALLVAL1 << "Sallval2:" << & Sallval2 << Endl; 
  COUT << "Storage order of static local variables:" << endl; 
  COUT << "SVAL1:" << & SVAL1 <"" SVAL2: "<< & SVAL2 << Endl; 
  COUT << "Storage order of local variables:" << endl; 
  COUT << Val1: "<< & Val1 <<" Val2: "<< & Val2 << endl; 
 }

source

Related Posts

IOS OpenGL ES wave special effect

virtualBox Install CentOS6 Enhanced Packaging Error Solutions and Configure Sharing Folder Field

CENTOS modify Oracle character set

1140 Look-And-Say Sequence-PAT Grade A

java recursively achieve multi -level menu

Random Posts

Animation simulatory carton blasting (implemented by AnimationSet) yang

ubuntu network card ENP0S3 is changed to ETH0

PAT Class A 1070 MoonCake

1 1 WordCloud Chinese garbled solution

ECharts add custom Geojson data implementation map display