Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions C/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[//]:: (Start of README with a markdown comment.)
# Here Are The C Codes

----

- Use this **[link](https://www.programiz.com/c-programming/online-compiler/)** to run *c codes*.
- code ***main-recursion.c*** is a program which use main() function.
- `main()` function used for recursive calls.
- print `hello` till user enter commands to execute.
- it will exit the code when `entered 0` for exit.
- don't use values other than `integers`.

----

[//]:: (End of README with a markdown comment.)
17 changes: 17 additions & 0 deletions C/recursion-with-main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<stdio.h>
int main()
{
int a;
printf("Enter command ::: ");
scanf("%d",&a);
if (a) {
printf("hello\n");
// Here's comes the recursive calls.
main();
}
// Here's comes the recursive exit.
// Recursion without exit isn't good practice.
// No one wants infinite calls.
else printf("Exit");
return 0;
}