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

c×Ö·û´® - C/C++ / CÓïÑÔ

C/C++ code:



#include "stdio.h"
int main(void)
{
char s1[] ="hello";
char s2[] = "wor";
strcpy(s1+strlen(s1),s2);
puts(s1);
return 0;
}




½á¹ûΪ hellowor

ÎÒÏëÎÊÏÂstrcpy µÚÒ»¸ö²ÎÊý s1+strlen(s1)ÊÇʲô¶«Î÷£¬ Ū²»Ã÷°×ÊÇÔõôʵÏÖµÄ
Õâ¸ö²»Ðаɣ¡
char s1[] ="hello";
 char s2[] = "wor";
Ê×ÏÈÄ㶨ÒåµÄ¶¼Êdz£Á¿Êý×飬²»ÄÜcopyµÄ£¡
ÔÙ¾ÍÊǼ´±ãÊÇÄÜcopy Äã s1µÄ³¤¶ÈÒ²²»¹»ÈÝÄÉ Á½¸öÖ®ºÍѽ£¡

destinationµÄµØÖ·¡£


strcpy(des,orign) ÊÇ´Óorigi¿½±´µ½des £¬ ¿½±´µÄ³¤¶ÈÊÇorginµÄÖ¸ÕëÖ¸ÏòµÄµØÖ·µ½´ÓÕâ¸öµØÖ·¿ªÊ¼ÕÒµ½µÄµÚÒ»¸ö\0¡£


s1ÕâÀï±ä³ÉÀïchar*£¬s1+strlen(s1)¾Í³ÉÁËs1µÄ×Ö·û´®Î²¡£




s1ÊÇ×Ö·û´®µÄÊ×µØÖ·...
strlen(s1)ÊÇs1µÄ³¤¶È.
ËùÒÔ¾ÍÊǽ«s2½ÓÔÚs1µÄºóÃæÁË.


ÕâÑù²»»áÕ»Òç³ö£¿¹Ö£¡

Êý×éÃûs1ÆäʵÊÇÒ»Ö¸Õ룬s1Ö¸Ïò¡°hello¡±µÄ"h"£¬¶østrlen(sl)ÊÇ·µ»Ø¡°hello¡±µÄ³¤¶È£¬
¼´strlen(s1)=5£¬¹Ês1+strlen(s1)ÊÇÖ¸Ïò¡°hello¡±ÖС°o¡±µÄÏÂһλÖá£
ËùÒÔ£ºstrcpy(s1+strlen(s1),s2);Ö»Êǽ«s2¸´ÖƵ½¡°o¡±µÄºóÃæ¡£Èç´Ë½á¹ûΪ"hellowor"¡£

LZ£¬¿ÉÒԵõ½Äã˵µÄ½á¹û£¿

s1+strlen(s1)ÊǵØÖ·°¡¡£s1±¾À´¾ÍÊÇs1Êý×éµÄ³õµØÖ·¡£ÔÙ¼ÓÉϳ¤¶È¾ÍÊÇs1µÄÄ©µØÖ·ÁË¡¢strcpyÊǸ´Öƺ¯Êý¡£²ÎÊýÊÇÖ¸Õë¡£¾ÍÊǼÌÐøÍùºóÃ渴ÖÆs2µÄÄÚÈÝ

CÓïÑÔÁé»î¶à±ä¡£¡£


Õâ¸öÎÊÌâÒÔÇ°ÎÒÎʹý¡£


Ïà¹ØÎÊ´ð£º

linux»·¾³ÏÂgethostbynameº¯ÊýÎÊÌâ - C/C++ / CÓïÑÔ

дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
   
  struct hostent *hp; 
char AlarmDevIP[20];  
  int x2;

hp = gethostbyname("www.google.com");
if (hp)
{ ......

ÇóÖú£ºC´úÂë¸Äд³ÉVB´úÂë - VB / »ù´¡Àà

Ë­ÄÜ°ïÎÒ°ÑÏÂÃæÕâЩ´úÂë¸Ä³ÉVBÐÎʽµÄ£¬¶àлÁË£¬¼±ÓÃ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......

c# Winform ´¥ÃþÆÁ³ÌÐò - .NET¼¼Êõ / C#

¹«Ë¾¿ª·¢Ò»¸ö´¥ÃþÆÁ³ÌÐò£¬ÎÒ¸ºÔðµÄÒ»¿é£¬ÊµÏÖÕâÑùÒ»¸ö¹¦ÄÜ£¬µ±Êó±êµã»÷´°¿ÚÖÐͼƬ£¨Ò»ÕÅͼ·Ö³É¼¸²¿·Ö£©µÄÆäÖÐÒ»²¿·Öʱ£¬½«Õⲿ·ÖͼƬ½ØÈ¡³öÀ´£¬µ¯³öеĴ°¿Ú£¬½«½ØÈ¡³öµÄͼƬÏÔʾ³öÀ´¡£ÎÒʹÓÃRectangeÀà¿ØÖÆÁË·µ»Ø£¬ ......

¸ÕѧÍêCµÄ»ù´¡£¬ÇóÏÂÒ»²½ - C/C++ / CÓïÑÔ

ÎÒ¸Õ°ÑÌ·ºÆÇ¿µÄµÚÈý°æµÄÊéѧÍ꣬ÎÒÖªµÀµÄÓÐC++£¬CºÍÖ¸Õë CȱÏݺÍÏÝÚå Cר¼Ò±ä³É£¬»¹ÓÐÊý¾Ý½á¹¹£¬ÎÒÏëÎÊÎÊÎÒÓ¦¸ÃÒÔʲô˳ÐòÀ´Ñ§ÄØ
CȱÏݺÍÏÝÚå Cר¼Ò±à³Ì
Êǽø½×µÄ£¬²»Óü±×Å¿´
ÖÁÓÚ
CºÍÖ¸Õë 
Äã²»Àí½âÖ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ