Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int *ar1 = (int*)malloc(5*sizeof(int));
- char *ar2 = (char*)malloc(20*sizeof(char));
- for(int i = 0; i < 5; i++) ar1[i] = i;
- memcpy(ar2, ar1, sizeof(5*sizeof(int)));
- for(int i = 0; i < 5; i++) printf("%d ", ar1[i]);
- printf("\n");
- for(int i = 0; i < 20; i++) printf("%d ", ar2[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement