ポインタ例1

それは、ポインタを関数複数の値を返します

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          { 0312831303130313130313031 }
 19          { 0312831303130313130313031 }
 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 }

おすすめ

転載: www.cnblogs.com/2018jason/p/12044625.html
おすすめ