»ªÎªC/C++±ÊÊÔÌâ3
1. ÕÒ´í
#define MAX_SRM 256
DSN get_SRM_no()
{
static int SRM_no;
int I;
for(I=0;I<MAX_SRM;I++,SRM_no++)
{
SRM_no %= MAX_SRM;
if(MY_SRM.state==IDLE)
{
break;
}
}
if(I>=MAX_SRM)
return (NULL_SRM);
else
return SRM_no;
}
´ð£º
(1). SRM_noûÓи³³õÖµ
(2). ÓÉÓÚstaticµÄÉùÃ÷£¬Ê¹¸Ãº¯Êý³ÉΪ²»¿ÉÖØÈ루¼´²»¿ÉÔ¤²â½á¹û£©º¯Êý£¬ÒòΪSRM_no±äÁ¿·ÅÔÚ³ÌÐòµÄÈ«¾Ö´æ´¢ÇøÖУ¬Ã¿´Îµ÷ÓõÄʱºò»¹¿ÉÒÔ±£³ÖÔÀ´µÄ¸³Öµ¡£ÕâÀïÓ¦¸ÃÈ¥µôstaticÉùÃ÷¡£
2. д³ö³ÌÐòÔËÐнá¹û
int sum(int a)
{
auto int c=0;
static int b=3;
c+=1;
b+=2;
return(a+b+C);
}
¡¡¡¡
void main()
{
int I;
int a=2;
for(I=0;I<5;I++)
{
printf("%d,", sum(a));
}
}
´ð£º8,10,12,14,16
¸ÃÌâ±È½Ï¼òµ¥¡£Ö»Òª×¢ÒâbÉùÃ÷Ϊstatic¾²Ì¬È«¾Ö±äÁ¿£¬ÆäÖµÔÚÏ´ε÷ÓÃʱÊÇ¿ÉÒÔ±£³ÖסÔÀ´µÄ¸³ÖµµÄ¾Í¿ÉÒÔ¡£
3.
int func(int a)
{
int b;
switch(a)
{
case 1: b=30;
case 2: b=20;
case 3: b=16;
default: b=0;
}
return b;
}
Ôòfunc(1)=?
´ð£ºfunc(1)=0£¬ÒòΪûÓÐbreakÓï¾ä£¬switchÖлáÒ»Ö±¼ÆËãµ½b=0¡£
4.
int a[3];
a[0]=0; a[1]=1; a[2]=2;
int *p, *q;
p=a;
q=&a[2];
Ôòa[q-p]=?
´ð
Ïà¹ØÎĵµ£º
Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í
DelphiÊý¾ÝÀàÐÍC/C++
ShorInt
8λÓзûºÅÕûÊý
char
Byte
8λÎÞ·ûºÅÕûÊý
BYTE,unsigned short
SmallInt
16λÓзûºÅÕûÊý
short
Word
16λÎÞ·ûºÅÕûÊý
unsigned short
Integer,LongInt
32λÓзûºÅÕûÊý
int,long
Cardinal,LongWord/DWORD
32λÎÞ·ûºÅÕûÊý
unsigned long
Int6 ......
#include<stdio.h>
#include<stdarg.h>
#include<string.h>
void demo(char *msg,...)
{
va_list argp;
int arg_number=0;
char *para = msg;
va_start(argp,msg);
while(1){
if ( strcmp( para, "\0") != 0 ) {
arg_number++;
printf("parameter %d is: %s\n",arg_number,p ......
ÔÚpb11Öн«C/S³ÌÐòת»»µ½B/SµÄ²½Öè(2009-01-06 21:12:20)
±êÇ©£ºÔÓ̸
·ÖÀࣺWebÏà¹Ø¼¼Êõ
ÔÚpb11Öн«C/S³ÌÐòת»»µ½B/SµÄ²½Öè
Ò»¡¢¿ª·¢»·¾³°²×°
1¡¢ÏȰ²×°windowsµÄIIS5.0ÒÔÉÏ
2¡¢ÔÙ°²×°
£¨1£©°²×°asp.net framework 2.0
£¨2£©°²×°Microsoft .NET Framework SDK 2.0, 3.0 or 3.5£¬ÎªÄܹ»ÔËÐÐ.net web·þÎñÒýÇ ......