VS2012 Error:不存在从“——”到“——*”的适当转换函数—已解决
来源:互联网 发布:马自达 mx5 rf 知乎 编辑:程序博客网 时间:2024/06/06 05:31
源代码功能为建立并输出链表。《C程序设计》P316。
源代码如下:
#include<stdio.h>
#include<malloc.h>
#define LEN sizeof(struct Student)
struct Student
{
long num;
float score;
struct Student* next;
};
int n;
struct Student* creat()
{
struct Student* head;
struct Student* p1,*p2;
n = 0;
p1 = p2 =(struct Student*)malloc(LEN);
scanf_s("%ld,%f",&p1->num,&p1->score);
head = NULL;
while (p1 -> num!= 0)
{
n = n + 1;
if(n == 1)head = p1;
else p2 -> next = p1;
p2 = p1;
p1 = (struct Student*)malloc(LEN);
scanf_s("%ld,%f",&p1 -> num,&p1 -> score);
}
p2 -> next = NULL;
return(head);
};
void print(struct Student head )
{
struct Student* p;
printf("\nNow,These %d records are:\n",n);
p = head;
if(head != NULL)
do
{
printf("%ld %5.1f\n",p->num,p->score);
p = p->next;
} while (p != NULL);
}
void main()
{
struct Student* head;
head = creat();
print(head);
}
编译时出现如下错误:
查找后发现是head忘了加*。将void print(struct Student head )改为void print(struct Student *head ),则编译时顺利通过。
- VS2012 Error:不存在从“——”到“——*”的适当转换函数—已解决
- MFC 不存在从 "CString" 到 "char *" 的适当转换函数
- VS2012 error C2668: “sqrt”: 对重载函数的调用不明确-已解决
- 解决“CvMat*”转换“Mat”没有适当的构造函数
- Javascript 原型继承(续)—从函数到构造器的角色转换
- 在OpenCV下出现不存在从CString到const char*的转换函数 解决方法
- 明源群面经历——学会适当突出
- 实现atoi——从char*到int的转换
- 不存在从CString到const char*的转换
- VS2012Error:不能将“bool”类型的值分配到“FILE*”类型的实体—已解决
- 转换到 COFF 期间失败: 文件无效或损坏——WTL从低版本到高版本转换2个fatal error处理
- 从vs2010转换项目到vs2012
- MySQL之——提示表不存在的解决方法error: 1146: Table doesn't exist
- error: ‘to_string’ is not a member of ‘std’———已解决
- error: #70: incomplete type is not allowed——已解决!
- Error: C3065E: type of input file 'XXX' unknown——已解决!
- keil中error: #70: incomplete type is not allowed——已解决!
- error: #70: incomplete type is not allowed——已解决!
- 如何在html页面联入css样式
- 道德经全文用字分析
- GCD,@synchronized 实现生产者-消费者模型
- git 初步使用 -- 提交代码
- 10014---CentOS6.5下kafka+ZooKeeper下载与安装详细教程-多机版本1
- VS2012 Error:不存在从“——”到“——*”的适当转换函数—已解决
- Mac OS X 上的ldd和strace的替代
- Mybatis 示例之 foreach
- 会场安排问题
- 在Eclipse上安装BuildShip Gradle插件,并创建Java Web项目
- 最优合并问题
- codeforces contest 355
- 小无聊————————Auticompelete TextView动态匹配输入的内容
- 汽车加油问题