-
memcpy()를 이용한 메모리 복사 예제Dev Language/C 2008. 11. 6. 14:59#include <stdio.h>
#include <string.h>
int main(){
char c = 'a';
int n=100;
double d = 8000.123;
char *str="asdfasdf";
chat temp[100];
char *p=templ
memcpy(p, &c, sizeof(char));
memcpy(p+=sizeof(char), &n, sizeof(int));
memcpy(p+=sizeof(int), &d, sizeof(double));
memcpy(p+=sizeof(double), &str, sizeof(charr*));
printf(%s\n", *(char**)p );
p-= sizeof(double);
printf("%s/31f\n", *(double*)p);
p-=sizeof(int);
...return 1;
}