18 AĞUSTOS 2011, PERŞEMBE
Kendi başlık oluşturmak C dosyası
Herkes baştan sona basit bir örnekle C üstbilgi dosyası oluşturmak için nasıl açıklayabilir.
CEVAP
18 AĞUSTOS 2011, PERŞEMBE
foo.h
#ifndef FOO_H_ /* Include guard */
#define FOO_H_
int foo(int x); /* An example function declaration */
#endif // FOO_H_
foo.c
#include "foo.h" /* Include the header (not strictly necessary here) */
int foo(int x) /* Function definition */
{
return x 5;
}
ana.c
#include <stdio.h>
#include "foo.h" /* Include the header here, to obtain the function declaration */
int main(void)
{
int y = foo(3); /* Use the function here */
printf("%d\n", y);
return 0;
}
GCC kullanarak derlemek için
gcc -o my_app main.c foo.c
Bunu Paylaş:
Bir kullanarak .php bir MySQL dökümü d...
Bir başlık olmadan bir İletişim oluştu...
gem yükleyin: gem yerel uzantı ('...
Nasıl Python ile PDF dosyası oluşturma...
SQL Server veritabanı dosyası oluşturm...