#include<stdio.h>
#include <string.h>
//可以退出的头文件
#include <stdlib.h>
//结构体的长度
#define DATALEN 15
//函数声明
//定义结构数组
struct wordUnit{
int id; //id
char word[10]; //词语
char depId[10]; //依存词语的id
char pos[10]; //词性
char depRel[10]; //依存目标的关系
};
int main(){
FILE *data;//要读取的文件指针
int i=0;//结构题数组移动
struct wordUnit words[DATALEN];
if((data=fopen("data3.txt","r"))==NULL){
printf("Can not open file\n");
return 0;
}
while(!feof(data)){
//原txt文档的数据之间是以空格隔开的
}
fclose(data);
for(int j=0;j<i;j++){
}
return 0;
}
扩展资料
1、使用关键字struct,它表示接下来是一个结构体。
2、后面是一个可选的标志(book),它是用来引用该结构体的快速标记。
/*
张三 244.00 244.00 542.00
李四 265.00 265.00 456.00
赵五 235.00 235.00 212.00
马六 285.00 285.00 415.00
Press any key to continue
*/
#include <stdio.h>