90: if (links->info[links->length-1].paths = malloc(connections*sizeof(char*))==NULL) {
perror("Malloc failed! Aborting execution\n"); exit(MF);}
for (j=0; j<connections; j++) {
93: if (links->info[links->length-1].paths[j] = malloc(250*sizeof(char))==NULL) {
perror("Malloc failed! Aborting execution\n"); exit(MF);}
}
在哪里
Link *links;
int connections;
typedef struct{ //Info of the link
int inode; //I-node
int prime_inode; //Corresponding i-node
int connections; //Number of hard links
int next_path; //Where to put the next path
char **paths; //Paths that refer to the i-node
} Link_info;
typedef struct {
int length; //Number of links
Link_info *info; //The array of the link info
}Link;
我得到这些警告
traverse.c:90:52: warning: assignment makes pointer from integer without a cast [enabled by default]
traverse.c:93:59: warning: assignment makes pointer from integer without a cast [enabled by default]
我想制作一个包含“连接数”单元格的字符串数组,每个字符串最多包含250个字符。我想知道这是怎么回事。
links->info[links->length-1].paths = malloc(connections*sizeof(char*))==NULL
==
优先于=
。这应该是
(links->info[links->length-1].paths = malloc(connections*sizeof(char*))) == NULL
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句