广告联系 设为首页 收藏本站 联系站长

网站首页 电子技术 单片机 PLC技术 微机接口 测试技术 控制理论 资源下载 嵌入式系统 工控论坛


现在位置:首页>>文档中心
文档搜索
下载资源搜索

互联网 www.jinhill.com
智能型电话远程遥控器
MCS-51系列单片机应用及接…
世界传感器市场分析(29)——…
应用VB4.0实现工业控制的实…
设计了一个3线IO传输
51单片机串口调试程序一列(不…
硬件工程师面试试题
Java串口通讯
80C51 IO口模拟串口通?…
程序员面试试题
    为提高锦山网在同类型网中的知名度,本站从即日起正式开放免费刊登电子产品广告业务!
    请你做好与本站内容相关的广告媒体,注意与本站版面的搭配,在不影响本站的美观的前提下本站从提交的广告中抽取精彩广告免费刊登在本站相关页面上。
    发布广告相关信息请阅读这里
        ——站长于2005-08-16发布

程序员面试试题
来自:jinhill,时间:2006-10-18 17:12:00

     1、头文件中的 ifndef/define/endif 干什么用?

2、#include <filename.h> 和 #include “filename.h” 有什么区别?

3、const 有什么用途?(请至少说明两种)

4、在c++ 程序中调用被 c编译器编译后的函数,为什么要加 extern 
“c”声明?

5、简述以下两个for循环的优缺点
for (i=0; i<n; i++)
{
if (condition)
dosomething();
else
dootherthing();
}

/***************************** /

if (condition)
{
for (i=0; i<n; i++)
dosomething();
}
else
{
for (i=0; i<n; i++)
dootherthing();
}

有关内存的思考题
/****************************/
void getmemory(char *p)

{

p = (char *)malloc(100);

}

void test(void) 

{

char *str = null;

getmemory(str); 

strcpy(str, "hello world");

printf(str);

}
请问运行test函数会有什么样的结果?
**********************************************/
char *getmemory(void)



char p[] = "hello world";

return p;

}

void test(void)

{

char *str = null;

str = getmemory(); 

printf(str);

}


请问运行test函数会有什么样的结果?
/********************************************/
void getmemory2(char **p, int num)

{

*p = (char *)malloc(num);

}

void test(void)

{

char *str = null;

getmemory(&str, 100);

strcpy(str, "hello"); 

printf(str); 

}

请问运行test函数会有什么样的结果?
/*******************************************/
void test(void)

{

char *str = (char *) malloc(100);

strcpy(str, “hello”);

free(str); 

if(str != null)

{

strcpy(str, “world”); 

printf(str);

}

}

请问运行test函数会有什么样的结果?
*********************************/
编写strcpy函数
已知strcpy函数的原型是
char *strcpy(char *strdest, const char *strsrc);
其中strdest是目的字符串,strsrc是源字符串。

(1)不调用c++/c的字符串库函数,请编写函数 strcpy

(2)strcpy能把strsrc的内容复制到strdest,为什么还要char * 类型的
返回值?
/**************************************************/
编写类string的构造函数、析构函数和赋值函数

已知类string的原型为:

class string

{

public:

string(const char *str = null); // 普通构造函数

string(const string &other); // 拷贝构造函数

~ string(void); // 析构函数

string & operate =(const string &other); // 赋值函数

private:

char *m_data; // 用于保存字符串

};

请编写string的上述4个函数。

Google
 
--------------------------------------------------------------------------------------------
发布者信息:jinhill 邮件 主页 IP:211.88.4....
-------------------------------------------------------------------------------------------- 本站所载文章力求原创,部分资料转载自网上,转载文章均要求发布者注明出处。
若您认为某些文章侵犯了您的权益,请通知我们,我们将在最短的时间内删除有关文章。
如果您对文章内容有任何心得或异议,请到锦山工控论坛发表高见!
 

Copyright© 2004-2008 Jinhill.Com , All Rights Reserved
联系电话:010-67801059 :42873774、13156987
webmaster@jinhill.com
皖ICP备05005472号
地址:北京市经济技术开发区荣华中路11号,邮编:100176