zoukankan      html  css  js  c++  java
  • memcpy

    参考: https://www.tutorialspoint.com/c_standard_library/c_function_memcpy.htm

    声明:

    void *memcpy(void *str1, const void *str2, size_t n)
    /*1. str1 − This is pointer to the destination array
    where the content is to be copied, type-casted to a pointer of type void*. *2.This is pointer to the source of data to be copied,
    type-casted to a pointer of type void* 3. n − This is the number of bytes to be copied.
    */

    Example:

    #include <stdio.h>
    #include <string.h>
    
    int main () {
       const char src[50] = "http://www.tutorialspoint.com";
       char dest[50];
       strcpy(dest,"Heloooo!!");
       printf("Before memcpy dest = %s
    ", dest);
       memcpy(dest, src, strlen(src)+1);
       printf("After memcpy dest = %s
    ", dest);
       
       return(0);
    }

    Output: 

    /*Before memcpy dest = Heloooo!!
    After memcpy dest = http://www.tutorialspoint.com
    */
    The Safest Way to Get what you Want is to Try and Deserve What you Want.
  • 相关阅读:
    sql STUFF用法
    关于原型链
    原生js事件绑定
    http常见7种请求
    关于linux的一些常用的指令
    flex布局详解
    html5 新增元素以及css3新特性
    css浮动以及清除
    css 浮动
    计算机网络
  • 原文地址:https://www.cnblogs.com/Shinered/p/10433163.html
Copyright © 2011-2022 走看看