Quine in programming terms is a program which outputs its own Source code. These are self-replicating programs and are very popular in the programming community. So, in this article we will see how we can achieve this.
This problem may sound complex, but this is actually quite easy and simple. So, the way we proceed with this is by opening the source file from the program and print out each and every character.
Sounds simple, doesn't it? Lets code it.
Things you need to know for this : Usage of File Pointers

Procedure: Lets break down the approach step by step
- Open the current file (fopen()) using a file pointer (in Read Mode)
- Read characters one after the other and print them until you reach the end of the file (EOF)
- Close the file
To open the file we'll use the fopen() function which takes in two parameters, the location of the file and mode of opening (Read/Write). Fortunately for us, there is a macro in C, to give us file's location, called
_FILE_ macro. Using this we can get the location/path of the current file.