| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1115 人关注过本帖
标题:哪位高手帮忙看一下!!type mismatch in redaclaration
只看楼主 加入收藏
duanjingyu
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-3-22
收藏
 问题点数:0 回复次数:1 
哪位高手帮忙看一下!!type mismatch in redaclaration
第19行
type mismatch in redeclaration of 'toupper'...
第22和23行
type mismatch in parameter 'ch' in call to 'toupper'...
第39行
Expression syntax in function...

我觉得很奇怪,明明没有错误嘛,toupper()的函数定义和声明没有出现类型不一致的情况啊,toupper()的定义也没有语法错误啊,郁闷中。。。。

 
 


 

#include  <stdio.h>
#include  <ctype.h>
#include  <string.h>

int *strstri(char str1[],char str2[]);

main()
{
   int *result;
   char *string1="My name is DJY.",*string2="name is";
   result=strstri(string1,string2);
   printf("%d %d",result[0],result[1]);
   return;
}

int *strstri(char str1[],char str2[])
{
   int i=0,loc_s=0,loc_o=0,res[2],*res_p;
   void toupper(char *tmp);    
   int compare(char s1[],char s2[],int cnt1,int cnt2);

   toupper(str1);
   toupper(str2);
   while(str1[i]!='\0')
   {
      if(str1[i]==str2[0])
      {
         loc_s=i;
         loc_o=compare(str1,str2,loc_s,1);
      };
   };
   loc_s=-1;
   res[0]=loc_s;res[1]=loc_o;
   res_p=res;
   return res_p;



   void toupper(char *tmp)
   {
      int cnt=0;
      while(tmp[cnt]!='\0')
      {
         if(tmp[cnt]>96&&tmp[cnt]<123)
            tmp[cnt]-=32;
         cnt++;
      };
      return tmp;
   }

   int compare(char s1[],char s2[],int cnt1,int cnt2)
   {
      while(s1[cnt1]!='0')
      {
         if(s1[cnt1]==s2[cnt2])
         {
            cnt1++;
            cnt2++;
            compare(s1,s2,cnt1,cnt2);
         }else{
            break;
         };
      };
      return cnt1;
   }
}
搜索更多相关主题的帖子: mismatch type toupper include 
2008-03-29 22:27
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
你用的函数名字和库函数同名字了..需要修改..还有就是字符串赋给指针被当字符串常量...是不允许修改的...

学习需要安静。。海盗要重新来过。。
2008-03-29 22:39
快速回复:哪位高手帮忙看一下!!type mismatch in redaclaration
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018545 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved