answersLogoWhite

0


Best Answer

A main (or not-main) function can return a value to its caller.

If the main function was called by the system, the return value means 0=success other=error-code.

Function main can call itself, but it is not common.

Example:

int main (int argc, char **argv)

{

int rc;

if (argc>1) rc= main (argc-1, argv+1)

else rc= 0;

return rc;

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Yes a main function can call itself.
The program containing this will not give a compile time error.
But it gives a segmentation fault error at run time

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Zero or more (it's zero for the most programs).

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Recursive.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which function calls itself repeatedly
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why javascript function name and variable name same?

Either a case of bad programming practise or probably the function calls itself.


Difference between function and recursive variable?

A function can map for sets with infinite elements. Recursive variables, being 'algorithms of algorithms', are restricted to finite elements.


What is the difference between left recursion and right recursion in a grammar?

Recursion is what it's called when a function calls itself. When a function calls itself immediately before returning, it's called tail recursion. Tail recursion can be more efficiently written as iteration. In fact a good compiler will recognize tail recursion and compile it as iteration. There is no such thing as left or right recursion in C programming.


What is a recursive function?

A recursive function is one that calls upon itself until a given result in the original call is met. Take a look at this example. Program Recursion; Uses crt; Var number:longint; Function Factorial(number:longint):longint; Begin if number > 0 then factorial:=number*factorial(number-1) else factorial:=1; End; Begin clrscr; readln(number); writeln(factorial(number)); readln; End. Note how the function factorial calls itself.


What is recursive call in terms of algorithm?

A recursive call in an algorithm is when a function (that implements this algorithm) calls itself. For example, Quicksort is a popular algorithm that is recursive. The recursive call is seen in the last line of the pseudocode, where the quicksort function calls itself. function quicksort('array') create empty lists 'less' and 'greater' if length('array') ≤ 1 return 'array' // an array of zero or one elements is already sorted select and remove a pivot value 'pivot' from 'array' for each 'x' in 'array' if 'x' ≤ 'pivot' then append 'x' to 'less' else append 'x' to 'greater' return concatenate(quicksort('less'), 'pivot', quicksort('greater'))

Related questions

What is direct recursion?

When a function calls itself it is called as direct recursion. A function calls other functions which eventually call the original function is called as indirect recursion.


What programs copy itself repeatedly?

malicious software that copies itself repeatedly


Why javascript function name and variable name same?

Either a case of bad programming practise or probably the function calls itself.


Difference between function and recursive variable?

A function can map for sets with infinite elements. Recursive variables, being 'algorithms of algorithms', are restricted to finite elements.


What is recurcive function in c?

A function that calls itself. Example: ProcessList (list *ptr) { if (ptr!=NULL) { DoSomething (ptr->data); ProcessList (ptr->next); } }


My phone is dropping calls, how do I fix it?

If your phone is repeatedly dropping calls, I would suspect that it is the phone itself and not your service. If it only happened in certain areas, then I would say it's the service. If it doesn't matter where this happens, I would still blame the phone.


What is a number repeatedly multiplied by itself?

It is called the base.


How many types of recursion are there in c language?

Recursion in c language is a method where the function calls itself, within or outside the scope. Using Recursion, complicated problems can be divided into smaller parts so that solving them becomes more manageable. The recursion technique is available in Java, JavaScript, and C++.serves the same purpose. The type of Recursion in C • Direct Recursion • Indirect Recursion. Direct Recursion Recursion can call the function n-number of times. In the case of direct Recursion, the function calls itself inside the same position or in the local scope Direct Recursion problems are the Fibonacci series, a program to print 50 natural numbers. Indirect Recursion In the case of Indirect Recursion, a function X calls function Y, and function Y calls any function Z. Under certain conditions, function Z calls function A. In this case, function A is indirectly related to function Z. Indirect Recursion is also known as mutual Recursion, as more than one function runs a program. It is a two-step recursive function call process for making a recursive function call. Below mentioned are also type of Recursion: Tail Recursion No Tail/Head Recursion Linear Recursion Tree Recursion Tail Recursion A function is said to be tail recursion if it calls itself and also calls the last or the previous statement executed in the process. Head Recursion A function is said to be Head Recursion if it calls itself and also calls the first or the beginning statement executed in the process. Linear Recursion A function is said to be a linear recursive function if it makes a single call to itself each time the procedure executes itself and grows linearly depending on the size of the problem. Tree Recursion Tree Recursion is different from linear Recursion. Rather than making only one call to itself, that function makes more than one recursive call to the process within the recursive function. Following are the steps to solve the recursive problem in C: Step 1: Create a function and assign the work a part should do. Step 2: Select the subproblem and assume that the function already works on the problem. Step 3: Get the answer to the subproblem and use it to resolve the main issue. Step 4: The 90% of the problem defined is solved.


What does the grandmother do to try to convince the Misfit to spare her life?

she repeatedly calls him a good man


What is the difference between left recursion and right recursion in a grammar?

Recursion is what it's called when a function calls itself. When a function calls itself immediately before returning, it's called tail recursion. Tail recursion can be more efficiently written as iteration. In fact a good compiler will recognize tail recursion and compile it as iteration. There is no such thing as left or right recursion in C programming.


What is a recursive function?

A recursive function is one that calls upon itself until a given result in the original call is met. Take a look at this example. Program Recursion; Uses crt; Var number:longint; Function Factorial(number:longint):longint; Begin if number > 0 then factorial:=number*factorial(number-1) else factorial:=1; End; Begin clrscr; readln(number); writeln(factorial(number)); readln; End. Note how the function factorial calls itself.


What is recursive call in terms of algorithm?

A recursive call in an algorithm is when a function (that implements this algorithm) calls itself. For example, Quicksort is a popular algorithm that is recursive. The recursive call is seen in the last line of the pseudocode, where the quicksort function calls itself. function quicksort('array') create empty lists 'less' and 'greater' if length('array') ≤ 1 return 'array' // an array of zero or one elements is already sorted select and remove a pivot value 'pivot' from 'array' for each 'x' in 'array' if 'x' ≤ 'pivot' then append 'x' to 'less' else append 'x' to 'greater' return concatenate(quicksort('less'), 'pivot', quicksort('greater'))