それは、ポインタを関数複数の値を返します
1の#include <stdio.hに> 2 のボイド month_day(int型年、int型 yearday、int型 * pmonth、INT * pday)。 3 4 INTメイン(ボイド) 5 { 6 int型の日、月、年、yearday。 7 のprintf(" 入力年とyearday:" ); 8 のscanf(" %D%D "、&年間、&yearday)。 9 month_day(年、yearday、&月、&日)。 10 のprintf("%D-%D-%D \ n " 、年、月、日); 11 12 リターン 0 ; 13 } 14 空隙 month_day(int型年、INT yearday、INT * pmonth、INT * pday) 15 { 16 int型K、 LEAP; 17 int型タブ[ 2 ] [ 13 ] = { 18 { 0、31、28、31、30、31、30、31、31、30、31、30、31 } 19 { 0、31、28、31、30、31、30、31、31、30、31、30、31 } 20 }。 21 22 飛躍=((年/ 4 == 0)&&(年/ 100!= 0))|| (年%400 == 0 )。 23 24 のために(K = 1 ; yearday>タブ[LEAP] [K]; K ++ ) 25 { 26 yearday - = タブ[LEAP] [K]。 27 } 28 29 * pmonth = K。 30 * pday = yearday。 31 }