[ create a new paste ] login | about

Link: http://codepad.org/90TBENdS    [ raw code | output | fork ]

C++, pasted on Jul 22:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct{
	char name[8];
	int age;
}PROFILE;

int main(){
	char c[10];
	PROFILE p1,p2;

	strcpy(p1.name,"hoge");
	p1.age = 10;

	memcpy(&p2,&p1,2);
	printf("p1:%s hoge:%d\n",p1.name,p1.age);
	printf("p2:%s hoge:%d\n",p2.name,p1.age);

	
	memcpy(c,&p1,10);
	printf("c:%s\n",c);

	return 0;
}


Output:
1
2
3
p1:hoge hoge:10
p2:ho@(X@� hoge:10
c:hoge


Create a new paste based on this one


Comments: