• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

悠悠客

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

strcpy 库函数 拷贝函数

strcpy 是在string.h 里面
#include "stdafx.h"
#include "string.h"

struct Student
{
int Sex;
char name[10];
short b;
};



int main(int argc, char* argv[])
{
    Student aa;

    strcpy(aa.name,"shusheng");
   
    printf("%x\n",sizeof(aa));
    return 0;
}

非常快的放入数据

定义结构体的好处
#include "stdafx.h"
#include "string.h"

struct Student
{
int a;
char name[10];
short number;
};



int main(int argc, char* argv[])
{
    Student aa[10];

    strcpy(aa[0].name,"shusheng");
    aa[0].a=20;
    aa[0].number=10;

    strcpy(aa[1].name,"xueshen");
    aa[1].a=10;
    aa[1].number=20;



   
    printf("%x\n",sizeof(aa));
    return 0;


}




来自为知笔记(Wiz)


posted on 2014-04-26 23:54  悠悠客  阅读(348)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3