ખીલો ખોદતા ખાણ જો મળે ઝવેરાતની, તો નિરાંતે તારી ભક્તિ કરું શામળા | ભલું થયું ભાંગી જંજાળ, નવી નક્કોર દેશે શ્રીગોપાળ | જે તુજથી ના થઈ શકે એ જ કરાવ પ્રભુ પાસે, પાણિયારું પ્રભુ ભરશે નહિ ભરશે નદી તળાવ

Kiran Chauhan

Cogito, ergo sum // I think, therefore I am.

TIL: #include literally copy-paste the content of it

— ,

I mean I already knew about this point already but I was still thinking that there will be some magic in-between. It can't be that simple - copy-paste! But, the I watched this video by antirez.

---

Create a file with name print.c and write the following code - yes, just a printf() statement.

printf("hello, world\n");

Create another file with name hello.c and write the following code.

#include <stdio.h>

int main(void) {
    #include "print.c"

    return 0;
}

Now, compile and run the hello.c program (without including print.c in compilation).

gcc hello.c && ./a.out 
hello, world

It prints the output - hello, world as #include directive copy-paste the content of print.c file.

If you need proof then use -E compilation option. It'll print the preprocessed output. Let's also pass -P option to pretty-print the output.

gcc -E –P hello.c

The output is big. So, I truncated to only last few lines.

// ...
// ...
extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
extern int __uflow (FILE *);
extern int __overflow (FILE *, int);

int main(void) {
printf("hello, world\n");
 return 0;
}

There it is!


સાહિત્યિક કાર્યક્રમો

  • તા. ૦૨-૧૮ ઓક્ટોબર ૨૦૨૬ - ગાંધી પુસ્તક મહોત્સવ, ગુજરાત વિદ્યાપીઠ, અમદાવાદ
  • તા. ૨૧-૨૫ ઓક્ટોબર ૨૦૨૬ - સંસ્કૃત વાગ્માધુરી 2026, રા. વિ. પાઠક સભાગૃહ, ગુજરાતી સાહિત્ય પરિસદ, આશ્રમ રોડ, અમદાવાદ.
  • તા. ૨૪–૨૫ ઓક્ટોબર ૨૦૨૬ - અમદાવાદ ઇન્ટરનેશનલ લિટરેચર ફેસ્ટિવલ
  • વધુ માહિતી માટે...

વર્ગીકૃત

કડીઓ

સૂચિત લેખો

ચોપડીઓ

જોયેલ