answersLogoWhite

0

Code to implement memcpy in c?

Updated: 12/23/2022
User Avatar

Wiki User

12y ago

Best Answer

unsigned char *

memcpy(unsigned char * s1, unsigned char * s2, long size)

{

long ix;

s1= (char *)malloc(sizeof(strlen(s2)));

for(ix=0; ix < size; ix++)

s1[ix] = s2[ix];

return s1;

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Code to implement memcpy in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

C code to implement the file allocation algorithm?

yes we can do it,in c


What is the memcpy library used for in computer programming?

The memcpy library is used in computer programming to copy the value of numbers from a source to the memory block destination. Memcpy is frequently used in the C++ programming language.


Program to implement strdup in C?

char *strdup (const char *s) { size_t len; char *p; if ( !s ) return NULL; len = strlen (s); p = malloc (len+1); if (p &amp;&amp; len) { memcpy (p, s, len); p[len] = '\0'; } return p; }


How is a bitwise copy created in c plus plus?

You could just use memcpy(3), using sizeof() to get the object size.


What is the VHDL code to implement NOR gate?

Below code can implement NOT gate in VHDL. The code is written in data flow model. Library ieee; use ieee.std_logic_1164.all; Entity gates is port (a : in std_logic; c : out std_logic); end gates ; architecture and1 of gates is begin c&lt;=not a; end and1;


Write a c program to copy the string without using strcpy?

use strcat, strncpy, stpcpy, sprintf, strlen+memcpy, etc


What is VHDL code to implement AND gate?

Below code can implement AND gate in VHDL. The code is written in data flow model. Library ieee; use ieee.std_logic_1164.all; Entity gates is port (a,b : in std_logic; c : out std_logic); end gates ; architecture and1 of gates is begin c&lt;=a and b; end and1;


What is the VHDL code to implement NAND gate in behavioral model?

Below code can implement NAND gate in VHDL. The code is written in behavioral model. Library ieee; use ieee.std_logic_1164.all; Entity gates is port (a,b : in std_logic; c : out std_logic); end gates ; architecture and1 of gates is begin process(a,b) Begin If (a=1 and b=1) then C&lt;='0'; Else C&lt;= '1'; End if; End process; End and1;


What is the VHDL code to implement NOR gate in behavioral model?

Below code can implement NAND gate in VHDL. The code is written in data flow model. Library ieee; use ieee.std_logic_1164.all; Entity gates is port (a,b : in std_logic; c : out std_logic); end gates ; architecture and1 of gates is begin c&lt;=a nand b; end and1;


What arethe advantages and disadvantages of aflowchart IN c language?

Nope, as flowcharts aren't part of C-language. Nonetheless, you can implement algorithms specified by flowcharts in C, but that might lead to unstructured code (also known as 'spaghetti-code'), which is outdated by forty years... Try using stuctograms instead.


What is The procedure entry point could not be located in the dll msvcr71 dll?

msvcr71.dll is a module containing standard C library functions such as printf, memcpy, and cos. It is a part of the Microsoft C Runtime Library.


Can you implement the same using c?

Some function are not using in c