文档介绍:该【C语言面试题总汇 】是由【fangjinyan2017001】上传分享,文档一共【74】页,该文档可以免费在线阅读,需要了解更多关于【C语言面试题总汇 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。 : .
$ C
kyliunx ()* 2008-04-26 09:51:53+ ,
C -./012
4. static345678 9:;<=>?***@A
1 .CDE6F
2 .GHF
7 . I6JKL345MN8
1I6OPQRSTUKLVOW
2I6RSTXYVZQ[\UKL]X[\^K_`W
2VGaKbcI6UdeGaKbcKLW
8 . fghijklmn
amoipqrmostUhinJ]un
9 . vwxypGze{3MN8|}3Ue45MN8
vx\~HGaUxy\~a
10 . 45e8 : .
ec_cV*1
11 .
e458
3& ¡¢£
12 . 45¤VZ¥>¦§¤8
constructor
13 . ¨©ª«¬­i®¯e458
0(n"2)
14 . °float x J“²c”´µif-¶W
if(x> &&x<-)
16. Internet·6¸@¹º»¼8½»¼¾¿ÀÁÂÃ8
tcp/ipÄ6À/ÅÆÀ/¹ºÀ/ÇÈÀ/ÉÀ
17. InternetÉÊËwIPÊËÌÍ·645»¼8
ARP (Address Resolution Protocol)(ÊËÏл¼)
ÊËÒÓÔ¦¸ÕyÔ8
IPÊË?yÔÖrU¹º×w¾Ø×WVÙe¿w“¹ÚÓ”ÛÜJÝÞYßZMÔ¸àe¹ºÜ¸à
e¾ØÜW
2 .6áÆâM,NcUã 1 ; NäSå«æçUèéM ƽcUê;vyÆW°C ë«W
æçÇìU6íîïEð
3 .VZðswitchWñòóeô
switchñVZ¦hóW
õ¦
1öxy\~Z{wvx\~÷ø8
ùôZUxyúûüvxW¿6vx\~Uý¿þ6"::"
!"#
$%&'
()
*+,-.%&$
/012
/+,-
23)4$56%&7 8
9:extern
;<=>?@externABC)D;<=>?EF
;<=GHI
JK%LM/NOP/Q
!RSTO)DLextern>?K%LU : .
P
WOX/Q
!RSTO
YZRSTO
33 %&
['.C<=\];<=G8^_Q8
9`
C <=Gstatica?EHI
C <=GHI
bcdeGfg$C <=GhijkhYZ
lO
43mnfor( ` 1 `)_Qpq8rd_Qst8
9:u while(1)v
53do...... while u while.......do _Qwx8
9:b$+,$yz{|}${|}z+,
63~Nll
#include<>
main()
(
int a,b,c,d;
a=10;
b=a++;
c=++a;
d=10*a++;
printf("b, c, d %d, %d, %d", b, c, d ) ;
return 0;
}
9:10, 12, 120
13static _Qwx8 staticu_Qwx8 static
_Qwx8
()Ibzstatic2P 2d>?
***@d>? *
>?
*wx
01d $ ¡'<=¢
£<=
¤ ¥¦§Pe01 ¨f
%&©<=¤
$ e
r<=Ggªr¡ 01¦$<=fg^©<=«
¬h­®
er<=G¯OX
°±²³l ´µ^}dµPr>?¨µPr¶R´ : .
µ^}dµPr01 ¦§Prª·¸
static01
¹
<=f
b<=Gªº©I^(stat
ic ),º©
b<=GIu%&
b<=ªº©
$;<=
GI»ª<=»\];<=
static _Qwx:static fjª¼$½¾¿
eÀ<=ÁÂG[
`
staticu_Qwx:staticf[jü$½$½ÄÅ$½ÆDk`
static_Qwx:static
Gf$Ç
È[ÉGÊË$ÇÌ
Í
23 
(ÎÏ)G
(w) GÐÑ~Å
( Î )G
33ÒIu%&:
typedef union {long i; int k[5]; char c;} DATE;
struct data { int cat; DATE cow; double dog;} too;
DATE max;
¥mn printf("%d",sizeof(struct date)+sizeof(max));ÓÔÆDd:___ 52___
9:DATEd$union,«ÖS.ØÙÚÛÜÝdint[5],Þ20Cß.àrÛád
20
datad$struct,ȱâÞÖS.Ľ^int4 + DATE20 + doubles = 32.
àÆDd20 + 32 = 52.
ã
F16ä å"intgd2Cß/QÆDdint2 + DATE10 + doubles = 20
43æuÏ_Qwx8
æçèçlÏ}èçl
53Nll
#include<>
int inc(int a)
{
return(++a);
}
int multi(int*a,int*b,int*c)
return(*c=*a**b); : .
typedef int(FUNC1)(int in);
typedef int(FUNC2) (int*,int*,int*);
void show(FUNC2 fun,int arg1, int*arg2)
{
INCp=&inc;
int temp =p(arg1);
fun(&temp,&arg1, arg2);
printf(',%d\n,,,*arg2);
}
main()
{
int a;
show(multi,10,&a);
return 0;
}
110
7
!"#$%&'()*+,“abed”)*-./“dcba”
1#include”"
2main()
3{
4 char*src="hello,world”;
5 char* dest=NULL;
6 int len=strlen(src);
7 dest=(char*)malloc(len);
8 char* d=dest;
9 char* s=src[len];
10> while(len-!=0)
11 d++=s-;
12 printf(H %s”,dest); : .
133 return 0;
143)
9:
>ê1
int main(){
char* src = "hello,world*1;
int len = strlen(src);
char* dest = (char*)malloc(len+1);//»^\0 ±ë$ÖS
char* d = dest;
char* s = &src[len-1];ìíîÚ}$Cï
while( len- != 0 )
*d++=*s-;
*d = 0;//ð»ñ\0
printf (M %s\nM,des t);
free(dest)^/ªòºóôÖS®õö÷ø
return 0;
}
>ê2
#include <>
#include <>
main()
(
char str[]="heHo,world”;
int len=strlen(str);
char t;
for(int i=0; i<len/2; i++)
(
t=str[i];
str[i]=str[len-i-1 ]; str[len-i-1 ]=t;
)
printf("%s”,str);
return 0; : .
}
1 .-1,2,7,28,,126~p28u 126GS/d_Q8^_Q8
ù$q9úº©d4"3-1=63
ûüdn"3-1( n ^ý0, 2, 4)
n"3+1( n ^þ 1, 3, 5)
9ú:63
2 .*Ïÿ
2 A,B, .
pushA;
(1)!"B #$%
(2)&'()*A +,- ./pop0push1B
(3)B 2 pop%
3456789:;<#0 (1 ),=>?***@AB FGHIJ+
KLMNOPQIJ#atool()R)3IJSQ#TU
IJVatol
WKLXMNOYPQJ
Z long atol(const char *nptr);
\]^
#include <>
#include <>
int main(void)
{
long I;
char *str = "98765432";
I = atol(lstr);
printf("string = %s integer = %ld\n", str, I);
return(O);
) : .
2 ._`abcZdeIJ)E C FG+fZTU5)E C+++fZTU5
c Zghi)C++Z inline
3 .jklkmnopqlrsTU
PPPp1ptk
4 .kuZ#TUkv
5 .voip;Zwxyz{
6 .|}~;-xyA
_
~ ~IJ)IJkv
7 .hkv#E|}xO
8 .enum string
(
x1,
x2,
x3=10,
x4,
x5,
}x
x= 0x801005, 0x8010f4 ;
9 .unsigned char *p1;
unsi