char a[6]={'h','e','l','l','o','\0'};
char*p="hello";
char *q=a;
关于字符串的函数:
char*strcpy(char *dst,char const * src);//会将’\0‘一块复制
char*strcat(char *dst,char const *src);
int strcmp(char const *s1,char const *s2);
char*strcpy(char *dst,char const * src,size_t len);
char*strcat(char *dst,char const *src,size_t len);//总是在结果字符串后面添加一个'\0'
int strcmp(char const *s1,char const *s2,size_t len);
int tolower(int ch);
int toupper(int ch);
内存操作:
void *memcpy(void *dst,void const *src,size_t length);
void *memmove(void *dst,void const *src,size_t length);//它的源和目标操作数可以重叠
void *memcmp(void const*a,void const *b,size_t length);
void *memchr(void const*a,int ch,size_t length);
void *memset(void *a,int ch,size_t length);
关于动态内存分配:
void * malloc(size_t size);
void free(void *pointer);
void *calloc(size_t num_elements,size_t element_size);
void realloc(void *ptr,size_t new_size);
关于字符串常量:
“xyz”+1
“xyz”[2]表示z
*(“xyz”+1)表示y
阅读(1075) | 评论(0) | 转发(0) |