Skip to content

Commit 702279f

Browse files
committed
Add a test of link
1 parent 2bee35f commit 702279f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

c/link_test/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PROJECT(LINK_TEST)
2+
CMAKE_MINIMUM_REQUIRED(VERSION 2.9)
3+
INCLUDE_DIRECTORIES(./include)
4+
AUX_SOURCE_DIRECTORY(./src DIR_SRC)
5+
ADD_EXECUTABLE(./bin ${DIR_SRC})

c/link_test/include/head.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>

c/link_test/src/main.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "../include/head.h"
2+
int main(){
3+
struct test {
4+
char name[20];
5+
int num;
6+
struct test *next;
7+
};
8+
struct test *test1=(struct test*)(malloc(sizeof(struct test)));
9+
scanf("%d",&test1->num);
10+
printf("%d\n",test1->num);
11+
return 0;
12+
}
13+

0 commit comments

Comments
 (0)