answersLogoWhite

0


Best Answer

Variables in C are not recursive. Functions are recursive.

Note that for functions to be truly recursive, they must only use arguments passed to them or automatic storage allocated from the stack. If they use other storage, they must implement a method of properly allocating and deallocating recursion instance variables. The classic example of a recursive function is the factorial function...

int factorial (int n) { if (n <= 2) return n; else return n * factorial (n-1); }

Data structures may have references to other elements of the same type, you might call this recursion - its also called self-referential structures. Example:

typedef struct TreeNode {

struct TreeNode *left, *right;
int data;

} TreeNode;

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What declaration should be used to use variable as recursive?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Declaration can appear anywhere in the body of java method ATrue B False?

Partially true and partially false. A variable's declaration must happen atleast one life before the usage of that variable. Therefore we can take this as declaration can be done anywhere provided we declare it before the usage. otherwise it would throw a compilation error.


How do you get a recursive pattern?

A recursive pattern is a pattern that goes like this 2,4,6,8 and on. A pattern rule which is used to find the next term.


Explain the scope and visibility of variables in c plus plus function?

If you define a variable inside of your function, the variable can be referred and used only inside of that function. It means that you will not able to use the variable in another function (including main). Area of code where your variable can be used after declaration is usually called visibility of the variable.


Which symbol is used with a variable to indicate to the script that you are reading the contents of that variable?

Which symbol is used with a variable to indicate to the script that you are reading the contents of that variable?


What is poiner value in c?

In c a pointer is a variable that points to or references a memory location in which data is stored. Each memory cell in the computer has an address that can be used to access that location so a pointer variable points to a memory location we can access and change the contents of this memory location via the pointer. Pointer declaration A pointer is a variable that contains the memory location of another variable. The syntax is as shown below. You start by specifying the type of data stored in the location identified by the pointer. The asterisk tells the compiler that you are creating a pointer variable. Finally you give the name of the variable. type * variable name Example: int *ptr; float *string;

Related questions

What is used to declare variables in Visual Basic?

declaration of variable is dim a as integer


Declaration can appear anywhere in the body of java method ATrue B False?

Partially true and partially false. A variable's declaration must happen atleast one life before the usage of that variable. Therefore we can take this as declaration can be done anywhere provided we declare it before the usage. otherwise it would throw a compilation error.


How do you get a recursive pattern?

A recursive pattern is a pattern that goes like this 2,4,6,8 and on. A pattern rule which is used to find the next term.


Explain the scope and visibility of variables in c plus plus function?

If you define a variable inside of your function, the variable can be referred and used only inside of that function. It means that you will not able to use the variable in another function (including main). Area of code where your variable can be used after declaration is usually called visibility of the variable.


Why you have to declare variable first in turbo c?

All variables (and constants) must be declared before they can be used. This is so the compiler knows exactly how much memory to allocate to the variable, as the declaration tells the compiler exactly what the variable's type is.


Define pointer to pointer in c?

Double (**) is used to denote the double pointer. As we know the pointer stores the address of variable, Double pointer stores the address of any pointer variable. Declaration : int **ptr2Ptr;


What should be used as a way to make an educated guess about the relationship between the independent variable and the dependent variable?

Inferential Statistics


In C Language if you write int a; a10; then which is Declaration and which is Definition of variable a?

the declaration is int a - you are declaring a variable type integer. Definition is when you define a variable or give it a value, so a = 10 would be a definitionAnsweri have an doubt.. i have read somewhere that whenever memory allocation takes place , it is called definition. and declaration just tells the nature of variable. in int a; --- the memory allocation is taking place. so it should be the definition.kindly reply and clarify my doubt. AnswerWhen you declare it, you tell it what its type it. (int a) that's when the compiler knows how much to allocate for it. you define it as a=10, or a=20000.AnswerThis refers to both definition and declaration why because it is allocating the memory in the statement int a;orint a =10;extern int a;is an declaration.Answerint a; This is a declaration, declaring that 'a' is a variable of type int which would occupy 4 bytes(in a 32-bit compiler). Here no memory space is allocated. But when you say, a=10; Here 'a' is given 4 bytes (actual memory allocation) when value 10 is stored. This is called definition. -Sushant Sharashchandra PainaikAnswerActually 'a10;' can be a 'useless calculation' or an 'undefined variable'. 'int a;' and 'int a=10;' are both definitions; whilst 'extern int a;' is just a declaration.in C, all variables should be declared to tell the compiler what the variable names are,and what type of data they hold. the variables must be declared b4 they are used. here int a; is declaration and a= 10 is its data type value.


When should a nonparametric test be used?

When the variable that is being tested has an unknown distribution.


What is class register?

Register storage class is a compiler hint that the variable will be often used, and that it should generate code, if it can, to keep the variable's value in a register.


Which symbol is used with a variable to indicate to the script that you are reading the contents of that variable?

Which symbol is used with a variable to indicate to the script that you are reading the contents of that variable?


What methods are used to place data in variables?

I will give examples in the Java language.Assign a value to a variable, with the equal sign. For example, if you want the variable "a" to have the value 5:int a;a = 5;Note that the first sentence declares the variable, this has to be done only once. After that, you can assign values to the variable several times; each value you assign will erase the previous value.The declaration and the assignment can be combined, thus:int a = 5;