603 views

1 Answer

–1 votes
–1 votes
We are not accessing variable j after exiting from function.

Parameter is passed as reference.

Address of a is passed to the function.

Inside the function,value nof j is copied to the address of a.

After exiting drom function, local variable j is deleted, but its value is already stored in address of a.

Thats how we accessed the value

Related questions

1.7k
views
1 answers
0 votes
488
views
0 answers
0 votes
Tejeshwara asked Jun 12, 2022
488 views
int main(int argc, char *argv[]) { int valid = 0; char str1[8] = "start"; char str2[8]; gets(str2); if (strncmp(str1, str2, 8) == 0) valid = 1; printf("buffer1: str1(%s),...
1.1k
views
3 answers
1 votes
jverma asked May 23, 2022
1,112 views
#include <stdio.h>int f(int n){ static int r = 0; if (n <= 0) return 1; r=n; return f(n-1) + r;}int main() { printf("output is %d", f(5)); return 0;}Ou...