edited by
566 views
0 votes
0 votes

When a function is recursively called, all automatic variables :

  1. are initialized during each execution of the function

  2. are retained from the last execution

  3. are maintained in a stack

  4. are ignored

edited by

1 Answer

1 votes
1 votes
void seq(int num){

     if(num<1)

          return;

     int a = num; // Automatic Variable.

     printf("%d, ", a);     

     seq(num-1);

}

seq(5);

O/P: 5, 4, 3, 2, 1

Here automatic variable "a" is initialized 5 times. Once for each call to seq() with non zero positive number as an argument.

Related questions

1 votes
1 votes
2 answers
1
go_editor asked Mar 27, 2020
6,325 views
What is the time required to insert an element in a stack with linked implementation ?$O (\log_2 n)$$O (n)$$O (n\log_2 n)$$O (1)$
0 votes
0 votes
2 answers
2
go_editor asked Mar 27, 2020
1,063 views
The equivalent postfix expression for $d{\large /}(e+f)+b*c$ :$defbc/++*$$def+/bc+*$$def+/bc*+$None of these
0 votes
0 votes
1 answer
3
go_editor asked Mar 27, 2020
820 views
Which one of the following is a physical data structure ?ArrayLinked listsStacksTables
0 votes
0 votes
1 answer
4
go_editor asked Mar 27, 2020
1,522 views
Which of the regular expressions corresponds to this grammar ?$S → AB/AS, A → a/aA, B → b$$aa^*b^+$$aa^*b$$(ab)^*$$a(ab)^*$