c语言
文章平均质量分 51
iicooder
求职搜索引擎,北京。linux c/c
展开
-
关于strcasecmp的一个小程序
在网上看到一个关于strcasecmp的一个例子程序,如下:#include #include int main() { char *a="abcdef"; char *b="AbCdEf"; if(!strcasecmp(a,b)) printf("%s=%s\n",a,b); return 0; } 可是在编译之后出现错误提示:error原创 2012-01-22 15:29:11 · 1137 阅读 · 0 评论 -
位操作运算
前些天遇到一段关于c语言位运算的代码。 英文原文如下: As an illustration of some of the bit operators, consider the function getbits(x,p,n) that returns the (right adjusted) n-bit field of x that begins at posi原创 2012-02-01 10:01:38 · 446 阅读 · 0 评论 -
scanf函数
//#include "stdafx.h" #include #include int main( ) { char string[50]; scanf("%[^\n]",string);// %[] 扫描字符集合,直到回车换行符号为结束。 printf("%s\n",string); /* char str[80];原创 2012-03-01 11:41:49 · 409 阅读 · 0 评论 -
函数调用计算面积
#include #include #define PI 3.1415926 float area(float r); float perimeter(float r); int main(int argc,char* argv[]) { float r; float s,l; printf("input radius:\n"); scanf("%f",&r原创 2012-03-02 16:48:22 · 1379 阅读 · 0 评论 -
计算n的阶乘
#include int f(int n) { int k; if(n > 1) k = n*f(n-1); else return 1; return k; } int main(int argc,char *argv[]) { int k = 4; printf("%d",f(k)); getchar(); retu原创 2012-04-03 16:35:27 · 589 阅读 · 0 评论