| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 406 人关注过本帖
标题:好心人帮忙下
只看楼主 加入收藏
zhangyi0594
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2011-10-25
收藏
 问题点数:0 回复次数:0 
好心人帮忙下
#include "string.h"
#include "stdio.h"   
#include "stdlib.h"   
#include "io.h"  
#include "math.h"  
#include "time.h"

#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#define MAXSIZE 100

char string[MAXSIZE+1];
int strassign(string t,char *chars)   //char *chars是将字符串的首地址复制进去的吗?
{
    int i;
    if(strlen(chars)>MAXSIZE)
    {
        return ERROR;
    }
    else
    {
        t[0]=strlen(chars); //这是将一个字符复制进去还是一整个字符串复制进去啊????
        for(i=1;i<=t[0];i++)
        {
            t[i]=*(chars+i-1);  //这个是什么看的 谁能说下?
        }
        return OK;
    }
}

int main()
{
    int i,*p;
    string s1,s2;
    strassign(s1,"abcdex"); //生成s1串中的字符,将字符串给s1
}
搜索更多相关主题的帖子: include return 字符串 
2011-11-29 16:44
快速回复:好心人帮忙下
数据加载中...
 
   



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

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