我看了关于这个问题的另外两个问题,但我认为它们是不同的。谢谢你的帮助。问题出在第18行。
.image {
height:100px;
background-color:red;
}
.item{
transform:translateY(-50%);
}
.center {
background-color:blue;
width:300px;
margin:0 auto;
}
.Aligner {
display: flex;
flex-direction:column;
}
.Aligner-item--top {
width:100%;
background:red;
}
.following {
width:100%;
background-color:yellow;
}
答案 0 :(得分:1)
代码中存在多个问题:
您将malloc()
的返回值转换为(x*)
,但将其存储到指向int
的指针,而不是指向x
的指针。你为什么这么做?如果正确配置了有用的警告,编译器将在此处诊断出潜在的错误。
scanf("%s", array[3].name1);
将一个单词存储到name1
成员的array
成员中,该成员尚未定义。 array
的大小为2
,唯一有效的索引值为0
和1
。此代码调用未定义的行为。
%s
scanf
格式也会导致潜在的缓冲区溢出,因为scanf
可以尝试存储超过29个字符加上空终止符的成员。您应该使用%29s
。
您的功能的目的是什么?