13378 - Dynamic Array Arrangement   

Description

再給定主要執行程式main.c (題號.c)、以及Header檔function.h (題號.h);請試著完成Header檔中未實現的函式:DynamicallySetArraySize()PrintArray()

Methods:

- void DynamicallySetArraySize(int **ary, int size) – 利用malloc()動態的分配size的空間給ary

- void PrintArray(int *ary, int size) – 將ary裡面所有的值印出來

 

function.c

#include "function.h"
 
void DynamicallySetArraySize(int **ary, int size)
{
    // TODO
}
 
void PrintArray(int *ary, int size)
{
    // TODO
}

Input

輸入符合以下格式

Size

Num1, Num2, Num3, Num4...

 

Note:

  1. Size代表總共會輸入多少數字,也代表陣列的長度
  2. Num代表輸入到陣列裡的數值
  3. 無需處理輸入

Output

輸出符合以下格式:

Num1 Num2 Num3 Num4 ....

 

Note:

  1. 輸出的最後必須要有一個換行符號 ('\n')
  2. 兩個數字間要有一個空格

Sample Input  Download

Sample Output  Download

Partial Judge Code

13378.c

Partial Judge Header

13378.h

Tags




Discuss