C通过头文件链接子函数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dreamdonghui/article/details/80914053

main.c

#include <stdio.h>
#include "other.h"

int main (void)
{
    printf("%d\n", getfavoritenumber());

    return 0;
}

other.h
Code:

#ifndef _OTHER_H_
#define _OTHER_H_

int getfavoritenumber(void);
#endif

other.c

#include "other.h"

int getfavoritenumber(void)
{
    return 3;
}

猜你喜欢

转载自blog.csdn.net/dreamdonghui/article/details/80914053