void *deref(const void *ptr, uint32_t offset) { if(ptr == NULL) { return NULL; } return copy_ptr((const uint8_t *) ptr + offset); }
int main(void) { double source[5] = {1.1, 2.2, 3.3, 4.4, 5.5}; double target1[5]; double target2[5]; double target3[5]; int x; printf("\n\n"); copy_arr(target1, source, 5); printf("Array: target1\n"); for (x = 0; x < 5; x++) printf("%d: %f\n", x, target1[x]); printf("\n"); copy_ptr(target2, source, 5); printf("Array: target2\n"); for (x = 0; x < 5; x++) printf("%d: %f\n", x, target2[x]); printf("\n"); copy_ptrs(target3, source, (source + 5)); printf("Array: target3\n"); for (x = 0; x < 5; x++) printf("%d: %f\n", x, target3[x]); printf("\n\n"); return 0; }
int main(void) { double source[5] = {1.1, 2.2, 3.3, 4.4, 5.5}; double target1[5]; double target2[5]; copy_arr(source, target1, 5); copy_ptr(source, target2, 5); return 0; }
int main(void) { double ar[2][5] = { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 0 } }; double ar1[2][5]; double ar2[2][5]; copy_arr(ar, ar1, 2); copy_ptr(ar, ar2, 2); return 0; }
static void log_argv(bson *b, const char *idx, int argc, const char **argv) { bson_append_start_array(b, idx); char index[5]; for (int i = 0; i < argc; i++) { char *value = copy_ptr(&argv[i]); if(value != NULL) { ultostr(i, index, 10); log_string(b, index, value, copy_strlen(value)); } } bson_append_finish_array(b); }
int main(){ const int LEN = 7; double array[LEN]; printf("********************%d********************\n", LEN); for(int i = 0; i < LEN; i++) scanf("%lf", array + i); double target[3]; copy_ptr(array + 2, target, 3); puts("array:\n"); for(int i = 0; i < LEN; i++) printf("%lf ", array[i]); putchar('\n'); puts("target:\n"); for(int i = 0; i < 3; i++) printf("%lf ", target[i]); putchar('\n'); return 0; }
int main(void) { double source[5] = {1.1, 2.2, 3.3, 4.4, 5.5}; double target1[5]; double target2[5]; int index; copy_arr (source, target1, 5); copy_ptr (source, target2, 5); for (index = 0; index < 5; index++) { printf("target1[%d] = %.1lf\n", index, target1[index]); printf("target2[%d] = %.1lf\n", index, target2[index]); } system("pause"); return 0; }
int main(void) { double source[5] = {1.1, 2.2, 3.3, 4.4, 5.5}; double target1[5] = {0}, target2[5] = {0}; printf("Before operation:\n"); printf("source :\t%g\t%g\t%g\t%g\t%g\n",source[0],source[1],source[2],source[3],source[4]); printf("target1:\t%g\t%g\t%g\t%g\t%g\n",target1[0],target1[1],target1[2],target1[3],target1[4]); printf("target2:\t%g\t%g\t%g\t%g\t%g\n",target2[0],target2[1],target2[2],target2[3],target2[4]); copy_arr(source, target1, 5); copy_ptr(source, target2, 5); printf("After operation:\n"); printf("source :\t%g\t%g\t%g\t%g\t%g\n",source[0],source[1],source[2],source[3],source[4]); printf("target1:\t%g\t%g\t%g\t%g\t%g\n",target1[0],target1[1],target1[2],target1[3],target1[4]); printf("target2:\t%g\t%g\t%g\t%g\t%g\n",target2[0],target2[1],target2[2],target2[3],target2[4]); return 0; }
int main(void){ int i; copy_arr(source, target1, 5); copy_ptr(source, target2, 5); printf("source[5] = "); for(i=0;i<5;i++) printf("%.1f, ", source[i]); printf("\ntarget1[5] = "); for(i=0;i<5;i++) printf("%.1f, ", target1[i]); printf("\ntarget2[5] = "); for(i=0;i<5;i++) printf("%.1f, ", target2[i]); printf("\n"); return 0; }
boost::shared_ptr< Base<EncodingT> > CppAttributeInterpreter<EncodingT>::clone() const { return boost::shared_ptr< Base<EncodingT> >(new CppAttributeInterpreter<EncodingT>(copy_ptr(getValue()))); }