• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ copy_array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中copy_array函数的典型用法代码示例。如果您正苦于以下问题:C++ copy_array函数的具体用法?C++ copy_array怎么用?C++ copy_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了copy_array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: isl_ast_node_user_get_expr

/* Print a statement for copying an array to or from the device.
 * The statement identifier is called "to_device_<array name>" or
 * "from_device_<array name>" and its user pointer points
 * to the gpu_array_info of the array that needs to be copied.
 *
 * Extract the array from the identifier and call
 * copy_array_to_device or copy_array_from_device.
 */
static __isl_give isl_printer *print_to_from_device(__isl_take isl_printer *p,
	__isl_keep isl_ast_node *node, struct gpu_prog *prog)
{
	isl_ast_expr *expr, *arg;
	isl_id *id;
	const char *name;
	struct gpu_array_info *array;

	expr = isl_ast_node_user_get_expr(node);
	arg = isl_ast_expr_get_op_arg(expr, 0);
	id = isl_ast_expr_get_id(arg);
	name = isl_id_get_name(id);
	array = isl_id_get_user(id);
	isl_id_free(id);
	isl_ast_expr_free(arg);
	isl_ast_expr_free(expr);

	if (!name)
		array = NULL;
	if (!array)
		return isl_printer_free(p);

	if (!prefixcmp(name, "to_device"))
		return copy_array(p, array, 0);
	else
		return copy_array(p, array, 1);
}
开发者ID:MatthiasJReisinger,项目名称:polly,代码行数:35,代码来源:opencl.c


示例2: main

int main(int argc,char *argv[])
{
	int N=atoi(argv[1]);
	item_t *array=malloc(N*sizeof(*array));
	item_t *array_2=malloc(N*sizeof(*array_2));
	int i;
	FILE *input;
	clock_t c1,c2;

	input=fopen("merged_sequence.dat","r");
	
	srand((unsigned)time(NULL));

	for(i=0;i<N;i++){
		array[i]=rand()%N;
	}

	copy_array(array_2,array,N);

	while(fgets(buffer,BUFFER_SIZE,input) != NULL){
		copy_array(array,array_2,N);
	
		c1=clock();
		shell_sort(array,0,N-1);
		c2=clock();
	
		printf("sequence: %s",buffer);
		printf("sort time: %fs\n\n",(double)(c2-c1)/CLOCKS_PER_SEC);
	}

	return(0);
}
开发者ID:algking,项目名称:Algorithms-in-C-Sedgewick,代码行数:32,代码来源:E6.45_merged_sequence.c


示例3: alloc_merge

/**@param global_array_index is used to save result to correct place*/
BigArrayPtr
alloc_merge(
		const BigArrayPtr left_array, int left_array_len,
		const BigArrayPtr right_array, int right_array_len ){
	BigArrayPtr larray = left_array;
	BigArrayPtr rarray = right_array;
	BigArrayPtr result = malloc( sizeof(BigArrayItem) *(left_array_len+right_array_len));
	if ( !result ){
		WRITE_FMT_LOG(LOG_DEBUG, "NULL pointer, for len=%d\n", left_array_len+right_array_len );
		return NULL;
	}
	int current_result_index = 0;
	while ( left_array_len > 0 && right_array_len > 0 ){
		if ( larray[0] <= rarray[0]  ){
			result[current_result_index++] = larray[0];
			++larray;
			--left_array_len;
		}
		else{
			result[current_result_index++] = rarray[0];
			++rarray;
			--right_array_len;
		}
	}

	//copy last item
	if ( left_array_len > 0 ){
		copy_array( result+current_result_index, larray, left_array_len );
	}
	if ( right_array_len > 0 ){
		copy_array( result+current_result_index, rarray, right_array_len );
	}

	return result;
}
开发者ID:bortoq,项目名称:zerovm,代码行数:36,代码来源:sort.c


示例4: merge

BigArrayPtr merge( BigArrayPtr dest_array, BigArrayPtr left_array, int left_array_len,
		BigArrayPtr right_array, int right_array_len ){
	if (!dest_array) return NULL;
	BigArrayPtr larray = left_array;
	BigArrayPtr rarray = right_array;
	int current_result_index = 0;
	while ( left_array_len > 0 && right_array_len > 0 ){
		if ( larray[0] <= rarray[0]  ){
			dest_array[current_result_index++] = larray[0];
			++larray;
			--left_array_len;
		}
		else{
			dest_array[current_result_index++] = rarray[0];
			++rarray;
			--right_array_len;
		}
	}

	//copy last item
	if ( left_array_len > 0 ){
		copy_array( dest_array+current_result_index, larray, left_array_len );
	}
	if ( right_array_len > 0 ){
		copy_array( dest_array+current_result_index, rarray, right_array_len );
	}

	return dest_array;
}
开发者ID:bortoq,项目名称:zerovm,代码行数:29,代码来源:sort.c


示例5: assert

/***********************************************************************
 * Turn a given motif into its own reverse complement.
 ***********************************************************************/
void reverse_complement_motif
  (MOTIF_T* a_motif)
{
  ALPH_SIZE_T size;
  int i, temp_trim;
  ARRAY_T* left_freqs;
  ARRAY_T* right_freqs;
  ARRAY_T* temp_freqs;   // Temporary space during swap.

  assert(a_motif->alph == DNA_ALPH);

  // Allocate space.
  size = (a_motif->flags & MOTIF_HAS_AMBIGS ? ALL_SIZE : ALPH_SIZE);
  temp_freqs = allocate_array(alph_size(a_motif->alph, size));

  // Consider each row (position) in the motif.
  for (i = 0; i < (int)((a_motif->length + 1) / 2); i++) {
    left_freqs = get_matrix_row(i, a_motif->freqs);
    right_freqs = get_matrix_row(a_motif->length - (i + 1), a_motif->freqs);

    // Make a temporary copy of one row.
    copy_array(left_freqs, temp_freqs);

    // Compute reverse complements in both directions.
    complement_dna_freqs(right_freqs, left_freqs);
    complement_dna_freqs(temp_freqs, right_freqs);
  }
  free_array(temp_freqs);
  if (a_motif->scores) {
    // Allocate space.
    temp_freqs = allocate_array(alph_size(a_motif->alph, ALPH_SIZE));

    // Consider each row (position) in the motif.
    for (i = 0; i < (int)((a_motif->length + 1) / 2); i++) {
      left_freqs = get_matrix_row(i, a_motif->scores);
      right_freqs = get_matrix_row(a_motif->length - (i + 1), a_motif->scores);

      // Make a temporary copy of one row.
      copy_array(left_freqs, temp_freqs);

      // Compute reverse complements in both directions.
      complement_dna_freqs(right_freqs, left_freqs);
      complement_dna_freqs(temp_freqs, right_freqs);
    }
    free_array(temp_freqs);
  }
  //swap the trimming variables
  temp_trim = a_motif->trim_left;
  a_motif->trim_left = a_motif->trim_right;
  a_motif->trim_right = temp_trim;
  //swap the strand indicator
  //this assumes a ? is equalivant to +
  if (get_motif_strand(a_motif) == '-') {
    set_motif_strand('+', a_motif);
  } else {
    set_motif_strand('-', a_motif);
  }
}
开发者ID:CPFL,项目名称:gmeme,代码行数:61,代码来源:motif.c


示例6: receive_msg

void receive_msg()
{
   unsigned int16 ip, lbody, index, pl;
   unsigned int8 msg[USB_EP1_RX_SIZE - 1], code, *body;
   unsigned int1 hasBody;
   
   usb_get_packet(1, msg, USB_EP1_RX_SIZE - 1);
   
   ip = (msg[0] + (msg[1] * 256));
   hasBody = bit_test(msg[2], 7);
   code = msg[2];
   bit_clear(code, 7);
  
#ifdef DEBUG_STREAM_A
   fprintf(A, "receive_msg IP: %Lu - Code: %u - HasBody: %u\n\r", ip, code, hasBody);
#endif

   if (hasBody)
   {
      lbody = (msg[3] + (msg[4] * 256));
      
      body = calloc(lbody - 1, sizeof(unsigned int8));
      
      pl = lbody;
      if (pl > USB_EP1_RX_SIZE - 6)
         pl = USB_EP1_RX_SIZE - 6;
      
      copy_array(msg, 5, body, 0, pl);
      index = pl;
      
      while(index < lbody - 1)
      {
         pl = lbody - index;
         if (pl > USB_EP1_RX_SIZE - 1)
            pl = USB_EP1_RX_SIZE - 1;
      
         while (!usb_kbhit(1));
         usb_get_packet(1, msg, USB_EP1_RX_SIZE - 1);
         copy_array(msg, 0, body, index, pl);

         index += pl;
      }
   
      process_msg(ip, code, lbody, body);
   
      if (body)
      {
         free(body);
      }
   }
   else
   {
      process_msg(ip, code, 0, body);
   }
}
开发者ID:Cliveburr,项目名称:AutoHome,代码行数:55,代码来源:USBTest.c


示例7: join_paths

void join_paths(char *path1,char *path2,char *new_path ){

/*	printf("strlen path1:%d\n",strlen(path1));
	printf("strlen path2:%d\n",strlen(path2));
	printf("path1; %s\n",path1);
*/
	add_to_buffer(&message_buffer, "joining paths:",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
	append_to_buffer(&message_buffer,path1,MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
	append_to_buffer(&message_buffer, " and ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
	append_to_buffer(&message_buffer, path2,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
	if ( (path1[(sizeof(path1)/sizeof(char))-2]=='/') && path2[0]!='/') {
		/*paths are compatiable. concatanate them. note -2 is because of \0*/  
		strcat(new_path,path1);
		strcat(new_path,path2);		
		//char new_path[(sizeof(path1)/sizeof(char))+(sizeof(path2)/sizeof(char))];
		//strcpy(new_path,strcat(path1,path2)); 
		//return new_path;
	}	
	else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]=='/') {
		/*paths are compatiable. concatanate them*/  
		strcat(new_path,path1);
		strcat(new_path,path2);		
		//char new_path[(sizeof(path1)/sizeof(char))+(sizeof(path2)/sizeof(char))];
		//strcpy(new_path,strcat(path1,path2)); 
		//return new_path;
	}
	else if ((path1[(sizeof(path1)/sizeof(char))-2]!='/') && path2[0]!='/') {
			/*need to add a "/". */  
		strcat(new_path,path1);
		strcat(new_path,"/");
		strcat(new_path,path2);
		//strcpy(new_path,strcat(path1,strcat("/\0",path2)));

#if 0
		copy_array(path1,new_path,0,0);
		copy_array('\0',new_path,0,(sizeof(path1)/sizeof(char)));
		copy_array(path2,new_path,0,(sizeof(path1)/sizeof(char))+1);
 old method now trying to use copy_array
		//char new_path[(sizeof(path1)/sizeof(char))+(sizeof(path2)/sizeof(char))+1];
		for (x=0;x<=(sizeof(path1)/sizeof(char))-1;x++){ 
			new_path[x]=path1[x];
		}
		new_path[x+1]='/';
		for (x=(sizeof(path1)/sizeof(char)) ,i=0 ;i<=(sizeof(path2)/sizeof(char));x++,i++){ 
			new_path[x]=path2[i]; 
		}
#endif

		//return new_path;
	}
开发者ID:hanfeng,项目名称:rtems-yaffs2,代码行数:50,代码来源:yaffs_tester.c


示例8: run_all_except_insertion

void run_all_except_insertion(int random_arr[], int sorted_arr[], int length)
{
    //copy of the input arrays to keep them intact
    int random_arr_copy[length];
    int sorted_arr_copy[length];
    
    //double arrays with running times
    double sorted_times[4];
    double random_times[4];
    
    //clock_t struct returned by the clock function for start and end times
    clock_t start, end;
    int ndx = 0;
    
    copy_array(random_arr, random_arr_copy, length);    
    copy_array(sorted_arr, sorted_arr_copy, length);
    
    //run quicksort getting elapsed time for each
    start = clock();
    quick_sort(random_arr_copy, 0, length - 1);
    end = clock();
    copy_array(random_arr, random_arr_copy, length);
    random_times[ndx] = ((double)(end - start)) / CLOCKS_PER_SEC;
    
    start = clock();
    quick_sort(sorted_arr_copy, 0, length - 1);
    end = clock();
    copy_array(sorted_arr, sorted_arr_copy, length);
    sorted_times[ndx++] = ((double)(end - start)) / CLOCKS_PER_SEC;
    
    //run heapsort
    start = clock();
    heap_sort(random_arr_copy, length, length);
    end = clock();
    copy_array(random_arr, random_arr_copy, length);
    random_times[ndx] = ((double)(end - start)) / CLOCKS_PER_SEC;
    
    start = clock();
    heap_sort(sorted_arr_copy, length, length);
    end = clock();
    copy_array(sorted_arr, sorted_arr_copy, length);
    sorted_times[ndx++] = ((double)(end - start)) / CLOCKS_PER_SEC;

    
    //run merge sort
    start = clock();
    merge_sort(random_arr_copy, 0, length - 1);
    end = clock();
    copy_array(random_arr, random_arr_copy, length);
    random_times[ndx] = ((double)(end - start)) / CLOCKS_PER_SEC;
    
    start = clock();
    merge_sort(sorted_arr_copy, 0, length - 1);
    end = clock();
    copy_array(sorted_arr, sorted_arr_copy, length);
    sorted_times[ndx++] = ((double)(end - start)) / CLOCKS_PER_SEC;
    
    output_table(random_times, sorted_times);
}
开发者ID:cbomgit,项目名称:hw5,代码行数:59,代码来源:hw5functions.cpp


示例9: init_hypervisor_platform

void __init init_hypervisor_platform(void)
{
	const struct hypervisor_x86 *h;

	h = detect_hypervisor_vendor();

	if (!h)
		return;

	copy_array(&h->init, &x86_init.hyper, sizeof(h->init));
	copy_array(&h->runtime, &x86_platform.hyper, sizeof(h->runtime));

	x86_hyper_type = h->type;
	x86_init.hyper.init_platform();
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:15,代码来源:hypervisor.c


示例10: whittle2

static void whittle2 (Array acf, Array Aold, Array Bold, int lag,
		      char *direction, Array A, Array K, Array E)
{

    int d, i, nser=DIM(acf)[1];
    const void *vmax;
    Array beta, tmp, id;

    d = strcmp(direction, "forward") == 0;

    vmax = vmaxget();

    beta = make_zero_matrix(nser,nser);
    tmp = make_zero_matrix(nser, nser);
    id = make_identity_matrix(nser);

    set_array_to_zero(E);
    copy_array(id, subarray(A,0));

    for(i = 0; i < lag; i++) {
       matrix_prod(subarray(acf,lag - i), subarray(Aold,i), d, 1, tmp);
       array_op(beta, tmp, '+', beta);
       matrix_prod(subarray(acf,i), subarray(Bold,i), d, 1, tmp);
       array_op(E, tmp, '+', E);
    }
    qr_solve(E, beta, K);
    transpose_matrix(K,K);
    for (i = 1; i <= lag; i++) {
	matrix_prod(K, subarray(Bold,lag - i), 0, 0, tmp);
	array_op(subarray(Aold,i), tmp, '-', subarray(A,i));
    }

    vmaxset(vmax);
}
开发者ID:jeffreyhorner,项目名称:cxxr,代码行数:34,代码来源:mAR.c


示例11: reverse_complement_pssm

/**************************************************************************
*
*	reverse_complement_pssm_matrix
*
*	Turn a pssm matrix into its own reverse complement.
*
 *************************************************************************/
static void reverse_complement_pssm (
  ALPH_T alph,
  MATRIX_T* pssm_matrix
)
{
  int i;
  ARRAY_T* left_scores;
  ARRAY_T* right_scores;
  ARRAY_T* temp_scores;   // Temporary space during swap.
  int length = get_num_rows(pssm_matrix);

  // Allocate space.
  temp_scores = allocate_array(alph_size(alph, ALL_SIZE));

  // Consider each row (position) in the motif.
  for (i = 0; i < (int)((length+1) / 2); i++) {
    left_scores = get_matrix_row(i, pssm_matrix);
    right_scores = get_matrix_row(length - (i + 1), pssm_matrix);

    // Make a temporary copy of one row.
    copy_array(left_scores, temp_scores);

    // Compute reverse complements in both directions.
    complement_dna_freqs(right_scores, left_scores);
    complement_dna_freqs(temp_scores, right_scores);
  }
  free_array(temp_scores);
} // reverse_complement_pssm_matrix
开发者ID:a1aks,项目名称:Haystack,代码行数:35,代码来源:pssm.c


示例12: merge

/* for a sub-part of main array S given by starting and
	ending indices, split in half, move pointers to a
	tmp array, and then walk the tmp arrays, restoring
	pointers back in S in sorted order */
void merge(int *S, int *tmp_S, int begin, int middle, int end)
{
	// some indices
	int i, j;

	copy_array(S + begin, tmp_S + begin, end);
	i = begin, j = middle;
	
	// printf("\told S:\t");
	// print_array(S, 0, 8);
	
	S += begin;

	// printf("\tmid S:\t");
	// print_array(S, 0, 8);
	
	while((i<middle) && (j<end))
		if(tmp_S[i] <= tmp_S[j]) 
			*S++ = tmp_S[i++];
		else
			*S++ = tmp_S[j++];
	
	while(i < middle)
		*S++ = tmp_S[i++];
	while(j < end)
		*S++ = tmp_S[j++];

	// printf("\tnew S:\t");
	// print_array(S, 0, 8);

}
开发者ID:brianmack,项目名称:algorithms,代码行数:35,代码来源:merge_sort.c


示例13: allocate_array

/***********************************************************************
 * Turn a given motif into its own reverse complement.
 * TODO this does not handle the scores matrix, and it should.
 ***********************************************************************/
void reverse_complement_motif
  (MOTIF_T* a_motif)
{
  int i, temp_trim;
  ARRAY_T* left_freqs;
  ARRAY_T* right_freqs;
  ARRAY_T* temp_freqs;   // Temporary space during swap.

  // Allocate space.
  //temp_freqs = allocate_array(get_alph_size(ALL_SIZE)); //this relys on a global which assumes DNA has ambigs which meme doesn't seem to use 
  temp_freqs = allocate_array(a_motif->alph_size + a_motif->ambigs);

  // Consider each row (position) in the motif.
  for (i = 0; i < (int)((a_motif->length + 1) / 2); i++) {
    left_freqs = get_matrix_row(i, a_motif->freqs);
    right_freqs = get_matrix_row(a_motif->length - (i + 1), a_motif->freqs);

    // Make a temporary copy of one row.
    copy_array(left_freqs, temp_freqs);

    // Compute reverse complements in both directions.
    complement_dna_freqs(right_freqs, left_freqs);
    complement_dna_freqs(temp_freqs, right_freqs);
  }
  free_array(temp_freqs);
  //swap the trimming variables
  temp_trim = a_motif->trim_left;
  a_motif->trim_left = a_motif->trim_right;
  a_motif->trim_right = temp_trim;
}
开发者ID:PanosFirmpas,项目名称:gimmemotifs,代码行数:34,代码来源:motif.c


示例14: is_safe

/* Checks state safety. Returns true if safe, else false. */
bool is_safe() {
    /* Work vector, length m. */
    int work[RESOURCES];
    /* Finish vector, length n. */
    bool finish[CUSTOMERS];

    /* Initialize work vector = available vector. */
    copy_array(available, work);

    /* Set all elements in finish vector to false. */
    set_all_false(finish);

    /* Find index i such that finish[i] == false && need[i] <= work. */
    int i = find_i(work, finish);

    /* If no such i exists, check if all finish elements are true. */
    if (i == -1) { //such I does not exist
        if (all_true(finish) == true) {
            /* The system is in a safe state! */
            return true;
        }
    }
    else { 
        /* work = work + allocation */
        add_vectors(work, allocation[i]);
        finish[i] = true;
        /* Go to step 2. */
        i = find_i(work, finish);
    }
}
开发者ID:bradtaniguchi,项目名称:BankersAlgorithm,代码行数:31,代码来源:banker.c


示例15: Exception

void Array2D<T>::setColumn(int columns)
{
	if (columns < 0)
	{
		throw Exception("Number of columns must be greater than or equal to 0");
	}

	if (m_array.getLength() == 0)
	{
		m_col = columns;
		m_array.setLength(m_row * m_col);
	}
	else
	{
		Array<T> copy_array(m_row * columns);

		for (int i = 0; i < m_row; i++)
		{
			for (int j = 0; j < columns; j++)
			{
				if ((((i * columns) + j) - (i * (columns - m_col))) < ((i * m_col) + m_col))
				{
					copy_array[(i * columns) + j] = m_array[(i * m_col) + j];
				}
			}
		}
		m_col = columns;
		m_array = copy_array;
	}
}
开发者ID:Roastern,项目名称:School-Projects,代码行数:30,代码来源:Array2D.cpp


示例16: pr_ctrls_copy_args

int pr_ctrls_copy_args(pr_ctrls_t *src_ctrl, pr_ctrls_t *dst_ctrl) {

  /* Sanity checks */
  if (!src_ctrl || !dst_ctrl) {
    errno = EINVAL;
    return -1;
  }

  /* If source ctrl has no ctrls_cb_args member, there's nothing to be
   * done.
   */
  if (!src_ctrl->ctrls_cb_args)
    return 0;

  /* Make sure the pr_ctrls_t has a temporary pool, from which the args will
   * be allocated.
   */
  if (!dst_ctrl->ctrls_tmp_pool) {
    dst_ctrl->ctrls_tmp_pool = make_sub_pool(ctrls_pool);
    pr_pool_tag(dst_ctrl->ctrls_tmp_pool, "ctrls tmp pool");
  }

  /* Overwrite any existing dst_ctrl->ctrls_cb_args.  This is OK, as
   * the ctrl will be reset (cleared) once it has been processed.
   */
  dst_ctrl->ctrls_cb_args = copy_array(dst_ctrl->ctrls_tmp_pool,
    src_ctrl->ctrls_cb_args);

  return 0;
}
开发者ID:OPSF,项目名称:uClinux,代码行数:30,代码来源:ctrls.c


示例17: main

int main(int argc, char* argv[]) {
    if (argc != NB_OF_ARGS + 1) {
        printf("Run the program with 10 command line arguments please.\n");
        return EXIT_FAILURE;
    }
    
    /* REPLACE WITH COMMENT WITH YOUR CODE */
    char* copy[NB_OF_ARGS + 1];
    copy_array(argv, copy, NB_OF_ARGS);
    // Reagrange words based on first digit, if any found in them.
    for (int w = 1; w <= NB_OF_ARGS; ++w) {
        int j = 0;
        char c;
        while((c = copy[w][j++])) {
            if(isdigit(c)) {
                int word_index = c - '0';
                if(word_index == 0)
                    word_index = 10;
                copy[w] = argv[word_index];
                break;
            }
        }
    }
    for (int w = 1; w <= NB_OF_ARGS; ++w)
        clean(copy[w]);
    
    for (int i = 1; i <= NB_OF_ARGS; ++i)
        printf("  %s", copy[i]);
    putchar('\n');
    return EXIT_SUCCESS;
}
开发者ID:awhillas,项目名称:comp9021,代码行数:31,代码来源:quiz7.c


示例18: calculate_heatconduct

/*
 * Juho Gävert & Santeri Hiltunen
 Starting point of calculation. Searches for temperature balance in Array for
 maximum iterations of max_iters.
 */
double calculate_heatconduct(Array* arr, unsigned int max_iters)
{

  if (max_iters == 0 || arr->width < 3 || arr->height < 3)
    return -1;

  Array* temp_arr = new_array(arr->width, arr->height);
  copy_array(arr, temp_arr);

  double prev_mean = -1;
  for (unsigned int i = 0; i < max_iters; ++i) {
    double new_mean = calculate_iteration(arr, temp_arr);

    swap_ptrs((void**) &arr, (void**) &temp_arr);

    if (conf.verbose) {
      printf("Iter: %d Mean: %.15f\n", i + 1, new_mean);
      if (conf.verbose > 1) {
        print_arr(arr);
      }
    }

    if (fabs(new_mean - prev_mean) < 0.0000000000001) {
      printf("Found balance after %d iterations.\n", i);
      del_array(temp_arr);
      return new_mean;
    }

    prev_mean = new_mean;
  }
  del_array(temp_arr);
  printf("Didn't find balance after %d iterations.\n", max_iters);
  return prev_mean;
}
开发者ID:Hilzu,项目名称:HeatConduction,代码行数:39,代码来源:calcu.c


示例19: f_assemble_class

void
f_assemble_class() {
   array_t *arr = copy_array( sp->u.arr );
   pop_stack();
   push_refed_array(arr);
   sp->type = T_CLASS;
}
开发者ID:Yuffster,项目名称:fluffOS,代码行数:7,代码来源:dwlib.c


示例20: main

int main() {
	char **list = malloc(sizeof(char*) * 3);
	list[0] = "Hello, world";
	list[1] = "cat is very cute";
	list[2] = NULL;

	char **list2 = malloc(sizeof(char*) * 3);

	copy_array(list2, list);

	printf("%s\n%s\n%s\n", list[0], list[1], list[2]);
	printf("%s\n%s\n%s\n", list2[0], list2[1], list2[2]);

	char **list3 = concat_array(list, list2);
	char **iter = list3;
	while (*iter != NULL) {
		printf("%s\n", *iter);
		iter++;
	}

	printf("%d\n", array_length(list));
	printf("%d\n", array_length(list2));
	printf("%d\n", array_length(list3));

	/*
	free_array(list);
	free_array(list2);
	free_array(list3);
	*/
	
	return 0;
}
开发者ID:aharotias2,项目名称:t-obmenu,代码行数:32,代码来源:strarraytest.c



注:本文中的copy_array函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ copy_chars函数代码示例发布时间:2022-05-30
下一篇:
C++ copyValuesToVector函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap