⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c74_41.htm

📁 经典c语言教程
💻 HTM
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>strcpy() 函数</title>
</head>

<body bgcolor="#ccefcc">

<blockquote>
  <p>我们已经说明 pts1 和 pts2 都是指向串的指针, 那么表达式: pts=pts1; 
  只是把串的指针而不是串本身拷贝到另一个指针中, 
  所以假设你确实想拷贝一个串, 你可以使用 strcpy() 函数。<br>
  <br>
  </p>
  <p align="center">函数 strcpy() 的工作如下: <!-- Aftershock c74_411.swf 3=550 4=320 19 40 --> 
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=3,0,0,0" ID="c74_411" WIDTH="550" HEIGHT="320">
    <param name="movie" value="../movie/c74_411.swf">
    <param name="quality" value="autohigh">
    <param name="menu" value="false">
    <param name="bgcolor" value="#ccefcc"><embed SRC="../movie/c74_411.swf" swLiveConnect="FALSE" WIDTH="550" HEIGHT="320" QUALITY="autohigh" MENU="false" BGCOLOR="#ccefcc" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
  </object>
<!-- EndAftershock c74_411.swf -->  <br>
  </p>
  <p align="left"><a href="javascript:show(pp)">我们也可以自己写 strcpy() 函数</a>。<br>
  </p>
  <div id="p1" style="display:'none'">
  <dd><div align="center"><center><table border="6" width="308" cellspacing="0" cellpadding="6" height="150" bordercolor="#FF9933">
      <tr>
        <th width="532" bgcolor="#FF9933">函数</th>
      </tr>
      <tr>
        <td ALIGN="center" width="532" bgcolor="#00FFFF"><p align="left">void str_cpy(char 
        str1[],*str2)<br>
        {<br>
        &nbsp;&nbsp;&nbsp; int count = 0;<br>
        &nbsp;&nbsp;&nbsp; while (*str2 != '\0')<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; str1[count++] = *str2++;<br>
        &nbsp;&nbsp;&nbsp; str1[count] = '\0';<br>
        } </td>
      </tr>
    </table>
    </center></div></dd>
  </div><script language="javascript">
<!--
	var pp=p1.style;
	function show(obj){
		obj.display='';
	}
-->
</script>

</blockquote>

<p align="center"><a href="javascript:close()">关闭</a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -