Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void copy_ptr(double source[], double target1[], int num, int offset);
- int main(void){
- int i;
- double array[7]={1,2,3,4,5,6,7};
- double array2[3];
- copy_ptr(array, array2, 3, 4);
- for(i=0; i<3; i++)
- printf("%f\n", array2[i]);
- return 0;
- }
- void copy_ptr(double source[], double target1[], int num, int offset){
- int i;
- double *ptr = (source+offset);
- double *ptr2=target1;
- for(i=0; i<num; i++){
- *ptr2=*ptr;
- ptr2++;
- ptr++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement