As we all know the concept of printing the given string repeatedly using various loops(for loop,while loop),recursion and some control structure also. But the question is how we will print the given string repeatedly i.e. infinitely without using any loops,recursion and any control structure?
Examples:
Input : GFG Output : GFGGFGGFGGFG...(It will print GFG infinitely).
The idea is to use system() to call the program itself. While compiling, we pass the executable file name “test”. We call system(test) which will execute the same program repeatedly, because system is a function which executes extern commands or executable files.
// The program is compiled using -O option // to produce output executable file name // as "test" #include<stdio.h> #include<stdlib.h> int main() { printf("GFG"); system("test"); return 0; } |
Output: It will print GFG infinitely.
This article is contributed by Bishal Kumar Dubey. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- How to print a number 100 times without using loop and recursion in C?
- Print a number 100 times without using loop, recursion and macro expansion in C?
- Print 1 to 100 in C++, without loop and recursion
- Print substring of a given string without using any string function and loop in C
- Write a C program to print "Geeks for Geeks" without using a semicolon
- How will you print numbers from 1 to 100 without using loop?
- How will you print numbers from 1 to 100 without using loop? | Set-2
- C program to print a string without any quote (singe or double) in the program
- Print "Hello World" in C/C++ without using any header file
- Sum of array Elements without using loops and recursion
- How to concatenate two integer arrays without using loop in C ?
- C | Loops & Control Structure | Question 1
- C | Loops & Control Structure | Question 2
- C | Loops & Control Structure | Question 3
- C | Loops & Control Structure | Question 4
- C | Loops & Control Structure | Question 5
- C | Loops & Control Structure | Question 6
- C | Loops & Control Structure | Question 7
- C | Loops & Control Structure | Question 8
- C | Loops & Control Structure | Question 9
Improved By : AvikSarkar

