3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by Dazaa
0

can a file other than a .h file be included with #include

Answer : Yes :)
Any file can be included using #include.. #include just inserts the contents of that file in your C program.

0

Answer : Yes :)
Any file can be included using #include.. #include just inserts the contents of that file in your C program.

can you give me any program as example, in which we are using #include and a file other than .h extension

0

can you give me any program as example, in which we are using #include and a file other than .h extension

Lets sayI have a file main.c and helloworld.inc
In main.c I will write

#include "helloworld.inc" //Including a file other than .h

and in
helloworld.inc I will write

#include <stdio.h>

int main()
{
        printf("Hello, World\n");
        return 0;
}

Now compile main.c and run the executable, It will print

Hello, World

0

yes the program i am working on now starts with:

#include <stdio.h> 
#include <string.h>
#include <stdlib.h>
#include <winsock2.h>
#include "myramdomize_windows2010.c"
#include "CRC_simple_windows.c"

#define WSVERS MAKEWORD(2,0)
WSADATA wsadata;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.