免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4197 | 回复: 1
打印 上一主题 下一主题

[C] 编译出现warning: assignment from incompatible pointer type [复制链接]

论坛徽章:
1
2015年辞旧岁徽章
日期:2015-03-03 16:54:15
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-08 18:50 |只看该作者 |倒序浏览
  1. /* open close list 表 */
  2. typedef struct
  3. {
  4.         int n_f;
  5.         int n_x;
  6.         int n_y;
  7.         int nfather_x;
  8.         int nfather_y;
  9.         struct spaylist *next;
  10. }spaylist;
  11. static  spaylist *open_list, *close_list;

  12. /*删除结点*/
  13. spaylist *del(spaylist *head,int num_x,int num_y)
  14. {
  15.         spaylist *p1, *p2;
  16.         if(head == NULL)
  17.         {
  18.                 printf("\nlist null!\n");
  19.                 return (head);
  20.         }
  21.         p1 = head;
  22.         while((num_y != p1->n_y ||num_x != p1->n_x )&& p1->next != NULL)
  23.         {
  24.                 p2=p1;
  25.                 p1=p1->next;//247行
  26.         }
  27.         if(num_x == p1->n_x && num_y == p1->n_y )
  28.         {
  29.                 if(p1==head)
  30.                 {
  31.                         head=p1->next;
  32.                 }
  33.         }else{
  34.                 p2->next=p1->next;
  35.         }

  36.         return (head);
  37. }
复制代码


编译出现
subpaylist.c:247: warning: assignment from incompatible pointer type 这个
p1=p1->next;这一行出现问题 类型似乎都一致的呀

论坛徽章:
3
天蝎座
日期:2014-10-25 13:44:312015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:48:31
2 [报告]
发表于 2010-01-09 12:57 |只看该作者
typedef struct
{
        int n_f;
        int n_x;
        int n_y;
        int nfather_x;
        int nfather_y;
        struct spaylist *next;
}spaylist;改成如下试试看?


typedef struct spaylist
{
        int n_f;
        int n_x;
        int n_y;
        int nfather_x;
        int nfather_y;
        struct spaylist *next;
}SPAY_LIST; <----特别是这里的大写,把函数里面的也改改。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP