please explain with program
laughing out loud
Matt Ellen
2010-07-12 12:08:31
+7
A:
main.c:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
#include "include.h"
return EXIT_SUCCESS;
}
include.h:
#include "nested.h"
nested.h:
printf("yes.\n");
aib
2010-07-12 12:09:42
I'd avoid "headers" being included within a function, but otherwise yours is better than mine! :) (I was merely using a program instead of trying to demonstrate.)
Roger Pate
2010-07-12 12:13:47
If this was real code and that include was unavoidable, I'd probably rename the include files to have a ".c" or a completely different extension (not to mention, a better filename.).
aib
2010-07-12 13:01:39
I strongly prefer to avoid both *.h and *.c in that case, since it can neither be included as a normal header nor compiled as a normal implementation file. I use *.inc unless the given project already has a convention. (Since you mentioned it. :P)
Roger Pate
2010-07-12 13:03:31