-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathprogram1.cpp
More file actions
33 lines (33 loc) · 790 Bytes
/
program1.cpp
File metadata and controls
33 lines (33 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<iostream>
#include<conio.h>
using namespace std;
void check(int *main_local_addr)
{
/*
objective:to check whether stack grows upward or downward
input parameters:
main_local_addr-it stores address of main local variable
return value:none
approach:-if address of function variable is greater than address of main local variable
then stack grows upward
otherwise
stack grows downward
*/
int func_par;
if(&func_par>main_local_addr)
cout<<"\n\tSTACK GROWS UPWARD";
else
cout<<"\n\tSTACK GROWS DOWNWARD";
}
int main()
{
/*
objective:to check whether stack grows upward or downward
input parameters:none
return value:none
approach:-calling function check
*/
int main_local_par;
check(&main_local_par);
getch();
}