易截截图软件、单文件、免安装、纯绿色、仅160KB

ACM c函数大全

函数名: abs 功  能: 求整数的绝对值
用  法: int abs(int i);
程序例:
#include <stdio.h>
#include <math.h>
int main(void)
{
  int number = -1234;
  printf("number: %d  absolute value: %d\n", number, abs(number));
  return 0;
}
函数名: atof
功  能: 把字符串转换成浮点数
用  法: double atof(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   float f;
   char *str = "12345.67";
   f = atof(str);
   printf("string = %s float = %f\n", str, f);
   return 0;
}
函数名: atoi
功  能: 把字符串转换成长整型数
用  法: int atoi(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   int n;
   char *str = "12345.67";
   n = atoi(str);
   printf("string = %s integer = %d\n", str, n);
   return 0;
}
函数名: atol
功  能: 把字符串转换成长整型数
用  法: long atol(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   long l;
   char *str = "98765432";
   l = atol(lstr);
   printf("string = %s integer = %ld\n", str, l);
   return(0);
}
函数名: bsearch
功  能: 二分法搜索
用  法: void *bsearch(const void *key, const void *base, size_t *nelem,  size_t width, int(*fcmp)(const void *, const *));
程序例:
#include <stdlib.h>
#include <stdio.h>
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
int numarray[] = {123, 145, 512, 627, 800, 933};
int numeric (const int *p1, const int *p2)
{
   return(*p1 - *p2);
}
int lookup(int key)
{
   int *itemptr;
   /* The cast of (int(*)(const void *,const void*))
      is needed to avoid a type mismatch error at
      compile time */
 &


相关文档:

C/C++面试题


1.求下面函数的返回值(微软)
int func(x)
{
int countx = 0;
while(x)
{
countx
++;
x = x&(x-1);
}
return countx;
}
假定x = 9999。 答案:8
思路:将x转化为2进制,看含有的1的个数。
2. 什么是“引用”?申明和使用“引用”要注意哪些问题?
答:引用就是某个目标变量的&l ......

c输出标准总结

  C输出格式总结 收藏
C输出格式总结
 
1 一般格式
   printf(格式控制,输出表列)
   例如:printf("i=%d,ch=%c\n",i,ch);
   说明:
   (1)“格式控制”是用双撇号括起来的字符串,也称“转换控制字符串”,它包括两种信息:
 &nbs ......

#ifdef __cplusplus extern "C" { #endif 的解释

关于#ifdef __cplusplus extern 
面试时被问到过,不甚明了,网上百度一下,整合了两个仁兄的文章,如下。:-)
时常在cpp的代码之中看到这样的代码:
#ifdef __cplusplus
extern "C" {
#endif
//一段代码
#ifdef __cplusplus
}
#endif
  
    这样的代码到底是什么意思呢?首先, ......

C/C++ 程序设计员应聘常见面试试题深入剖析

1.引言
  本文的写作目的并不在于提供C/C++程序员求职面试指导,而旨在从技术上分析面试题的内涵。文中的大多数面试题来自各大论坛,部分试题解答也参考了网友的意见。
  许多面试题看似简单,却需要深厚的基本功才能给出完美的解答。企业要求面试者写一个最简单的strcpy函数都可看出面试者在技术上究竟达到了怎样的 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号