533 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

0 votes
0 votes
1 answer
1
0 votes
0 votes
0 answers
3
Tejeshwara asked Jun 12, 2022
458 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 votes
1 votes
3 answers
4
jverma asked May 23, 2022
1,027 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...