try along these lines:
Code:
#include<stdio.h>
typedef struct {
char *name;
int start;
int ndays;
} month;
display_month(int i,month *m){
printf("\ns m t w t f s" );
printf("\n");
int c= (m+i)->start;
for(int j=1;j<c;j++)printf(" ");
for(int j =1;j<=(m+i)->ndays;j++){
if(j>9)printf("%d ",j); else
printf("%d ",j);
c++;
if(c==8){c=1;printf("\n");}
}
};
main(){
month k[13];
k[1].name ="january"; // for jan
k[1].start=4; // jan 1st is a wednesday,wednesday=4
k[1].ndays=31; // jan has 31 days
k[2].name="feburary";
k[2].start=2; //feb 1 is monday ,monday=2
k[2].ndays=28; // feb has 28 days
display_month(2,k);
}