hx_x的个人空间 https://blog.eetop.cn/1305415 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

C语言笔记

已有 1408 次阅读| 2018-5-25 16:11 |系统分类:芯片设计

1)1LL

1 is of type int
1L is of type long int
1LL is of type long long int
 (a type introduced to the C standard in 1999 and to the C++ standard in 2011, but commonly provided before that as an extension).

2)函数名: calloc

  功 能: 在内存的动态存储区中分配n个长度为size的连续空间,函数返回一个指向分配起始地址的指针;如果分配不成功,返回NULL。

  跟malloc的区别:calloc在动态分配完内存后,自动初始化该内存空间为零,而malloc不初始化,里边数据是随机的垃圾数据。

  用 法: void *calloc(unsigned n,unsigned size);

  头文件:stdlib.h或malloc.h

3)size_t 和 ssize_t

      size_t的正确定义应该是typedef unsigned long size_t。为了增强程序的可移植性,便有了size_t,它是为了方便系统之间的移植而定义的,不同的系统上,定义size_t可能不一样。 在32位系统上 定义为 unsigned int 也就是说在32位系统上是32位无符号整形。在64位系统上定义为 unsigned long 也就是说在64位系统上是64位无符号整形。

       ssize_t是signed size_t。

4)memcpy()函数

函数原型 :void *memcpy(void*dest, const void *src, size_t n);

功能:由src指向地址为起始地址的连续n个字节的数据复制到以destin指向地址为起始地址的空间内。

头文件:#include<string.h>

返回值:函数返回一个指向dest的指针。



点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 6

    获赞
  • 4

    评论
  • 1431

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-3-28 22:26 , Processed in 0.013370 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部