C常用函数
检查空格字符
#include <ctype.h>
int isspace ( int c );
http://www.cplusplus.com/reference/clibrary/cctype/isspace/
Checks if parameter c is a white-space character.For the purpose of this function, standard white-space characters are:
' '
(0x20)
space (SPC)
'\t'
(0x09)
horizontal tab (TAB)
'\n'
(0x0a)
newline (LF)
'\v'
(0x0b)
vertical tab (VT)
'\f'
(0x0c)
feed (FF)
'\r'
(0x0d)
carriage return (CR)
/* isspace example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
int c;
int i=0;
char str[]="Example sentence to test isspace\n";
while (str[i])
{
c=str[i];
if (isspace(c)) c='\n';
putchar (c);
i++;
}
return 0;
}
/*
This code prints out the C string character by character, replacing any white-space character by a newline character. Output:
Example
sentence
to
test
isspace
*/
memcpy实现:
char *strcpy(char *strDest, const char *strSrc){
assert((strDest!=NULL) && (strSrc !=NULL)); // 2分
char *address = strDest; // 2分
while( (*strDest++ = * strSrc++) != '\0' ) // 2分
NULL ;
return address ; // 2分
}
相关文档:
C/C++中Static的作用详述
一.在C语言中,static的字面意思很容易把我们导入歧途,其实它的作用有三条。
(1)先来介绍它的第一条也是最重要的一条:隐藏。
当我们同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性。为理解这句话,我举例来说明。我们要同时编译两个源文件,一个是a.c,另一个是m ......
今天解答一些同学在学开发过程中的普遍问题,就是如何学好一门语言?
我是这样来理解的,要做任何事物,首先要分析为什么要做,只有把核心的,内心的原因找到才能把一件事情做好,否则,你花再多的学费学某种技术仍然会一无所或,从我个人的成长过程来将我是从97年接触计算机,开始学的一踏糊涂,不知道老师在讲什么,不知道学了会有什 ......
#include <stdio.h>
int main()
{
int a[5]={1,2,3,4,5};
int *ptr1=(int*)(&a+1);
int *ptr2=(int*)((int)a+1);
printf("%p,%x,%p\n",(int)a,*(ptr2+1),ptr1);//(int*)(&a));
printf("%d\n",(int*)(&a-16));
printf("%d,%x\n",ptr1[-1] ......