Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

cÖ¸ÕëµÄ¸÷ÖÖÓ÷¨ÊÔÑé

#include <iostream.h>
void fun0(int* p)
{
int* a=new int[3];
*a=0;
*(a+1)=1;
*(a+2)=2;
p=a;
}
void fun1(int* &p)
{
int* a=new int[3];
*a=0;
*(a+1)=1;
*(a+2)=2;
p=a;
}
void fun2(int* p)
{
*p=0;
*(p+1)=1;
*(p+2)=2;
}
//warning:returning address of local variable or temporary
int* fun3()
{
int a[]={1,2,3};
return a;
}
//warning C4172: returning address of local variable or temporary
int*& fun4()
{
int* a=new int[3];
a[0]=0;
a[1]=1;
a[2]=2;
return a;
}
void fun5(int* p[3])
{
*p[0]=0; *(p[0]+1)=10;
*p[1]=1; *(p[1]+1)=11;
*p[2]=2; *(p[2]+1)=12;
}
//cannot convert from 'int [3]' to 'int *&
/*
int*& fun6()
{
int a[]={1,2,3};
return a;
}
*/
void main()
{
int* p=new int[3];
// int* p; //runtime error:the memory connot be written
//it is necessory to allocate memory
cout<<"test: void fun0(int* p)"<<endl;
fun0(p);
for(int i=0;i<3;i++){
cout<<*(p+i)<<endl;
}
delete[3] p;
p=new int[3];
cout<<endl<<"test: void fun1(int* &p)"<<endl;
fun1(p);
for(i=0;i<3;i++){
cout<<*(p+i)<<endl;
}
delete[3] p;
p=new int[3];
cout<<endl<<"test: void fun2(int* p)"<<endl;
cout<<" allocate memory for the parameter"<<endl;
fun2(p);
for(i=0;i<3;i++){
cout<<" "<<*(p+i)<<endl;
}
cout<<" donot allocate memory for the parameter"<<endl;
cout<<" memory connot be written"<<endl;
/*
int* pt;
fun2(pt); //runtime error:memory connot be written
for(i=0;i<3;i++){
cout<<*(pt+i)<<endl;
}
*/
delete[3] p;
p=new int[3];
cout<<endl<<"test: int* fun3()"<<endl;
cout<<" debug assertion failed"<<endl;
/*
p=fun3(); //debug assertion failed
for(i=0;i<3;i++){
cout<<*(p+i)<<endl;
}
*/
delete[3] p;
p=new int[3];
cout<&


Ïà¹ØÎĵµ£º

C/C++ ±ê×¼º¯ÊýÓ¦ÓÃС½á Ö® Ëæ»úº¯Êý

×Ô´Ó½Ó´¥ÕâÃÅÓïÑÔµ½ÏÖÔÚÓÐÒ»¸ö¶àÐÇÆÚµÄʱ¼äÁË£¬ËäÈ»ÒÔºóµÄ·»¹ºÜ³¤£¬»áÓöµ½¸÷ÖÖÀ§ÄÑ£¬µ«Ö»ÒªÓÐÄÍÐĺÍÒãÁ¦£¬»¹Òª½Å̤ʵµØµÄ´òºÃ»ù´¡£¬¾ÍÒ»¶¨ÄÜÓг¤Í¾µÄ½ø²½£¬ºÇºÇ£¬Ï£ÍûÔÚÕâÀïµÄÿһ¸öÈ˶¼ºÍÎÒÒ»Æð¼ÓÓÍ£¬²»¶Ï½ø²½¡£
Ëæ»úº¯Êý¶ÔÿÖÖ±à³ÌÓïÑÔÀ´Ëµ¶¼ÊÇÒ»¸ö²»¿ÉȱÉٵĻ·½Ú£¬ÄÇôÔÚC++ÖÐËüÊÇÈçºÎÓ¦Óõģ¬ÕâÀïΪÁË·½±ãÀí½â£¬¶ÔÒÔÇ ......

Linux: S3C2410µÄRTCÇý¶¯

----------------------------------------------------------------------------------------------------------------------------------------
/**/
/*
********************************************************************************************************
*  @Description:s3c2410µÄrtcÇý¶¯µÄʵ ......

¾­µäC/C++ÃæÊÔÌâ

1.½éÉÜÒ»ÏÂSTL£¬Ïêϸ˵Ã÷STLÈçºÎʵÏÖvector¡£
Answer:
     STL (±ê׼ģ°æ¿â£¬Standard Template Library)ËüÓÉÈÝÆ÷Ëã·¨µü´úÆ÷×é³É¡£
     STLÓÐÒÔϵÄһЩÓŵ㣺
     ¿ÉÒÔ·½±ãÈÝÒ×µØÊµÏÖËÑË÷Êý¾Ý»ò¶ÔÊý¾ÝÅÅÐòµÈһϵÁеÄËã·¨£»
 &nb ......

CÅÌת»»ÎªNTFS¸ñʽ.cmd

@ ECHO OFF
@ ECHO.
@ ECHO.                               ˵   Ã÷
@ ECHO ----------------------------------------------------------------- ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ