The description for the following problem is that :
I can not move my months in to the 3 dimentional array.. I have done this coding already

1.get year from keyboard
2.generate a yearly calendar using a 3-dimensional array
3.display this calendar three months at a time across the screen
4.repeat this process (ask for another year and display that year’s calendar in the same way) until END is entered.


This one works but one month at a time.. I want 3 months at a time and one after another for example
months

1 2 3
4 5 6
7 8 9
10 11 12
Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>

int cal[6][7], day;

void main(void);
void cleararray(void);
void generatecal(int);
void dumparray(char []);

void cleararray(void)
{
    int row, col;

   for (row=0; row<=5; row++)
       for (col=0; col<=6; col++)
          cal[row][col] = 0;
}

void generatecal(int daysofmonth)
{
    int row = 0, col, d;

    col = day;
    for (d=1; d<=daysofmonth; d++)
   {
       cal[row][col] = d;
      col++;
      if (col == 7)
      {
          row++;
         col = 0;
      }
   }
   /* assign the first day of the next month */
   day = col;
}

void dumparray(char month[])
{
    int d, row, col;

   /* dump array content - generate output */
   for (d=1; d<=(21-strlen(month))/2; d++)
       printf(" ");
   printf("%s\n\n", month);
   printf("  S  M  T  W  R  F  S\n");
   for (row=0; row<=5; row++)
   {
       for (col=0; col<=6; col++)
         if (cal[row][col] == 0)
             printf("   ");
         else
              printf("%3d", cal[row][col]);
      printf("\n");
   }
}

void main(void)
{
    int row = 0, col, m, year;
   char monthnames[12][10] = {"January", "February", "March", "April",
                                    "May", "June", "July", "August", "September",
                            "October", "November", "December"};
   int monthdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
   int firstdays[28] = {2, 3, 4, 5, 0, 1, 2, 3, 5, 6, 0, 1, 3, 4, 5, 6,
                               1, 2, 3, 4, 6, 0, 1, 2, 4, 5, 6, 0};

   printf("Enter year: ");
   scanf("%d", &year);
   if (year % 4 == 0) monthdays[1] = 29;
    day  = firstdays[(year - 1901) % 28];

   for (m=0; m<=11; m++)
   {
       cleararray();
        generatecal(monthdays[m]);
        dumparray(monthnames[m]);
       getch();
   }
}

If anyone could please contct me Thank you..

tagged by Salem