Posts

Showing posts from November, 2018

calendar program using switch case

   calendar program using switch case #include<stdio.h> #include<string.h> int daynumber(int day,int month,int year) {     int t[]={0,3,2,5,0,3,5,1,4,6,2,4};     return (year+(year/4)-(year/100)+(year/400)+t[month-1]+day)%7; } char *getmonthname(int n) {     char *months[]={"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"};     return(months[n]); } int numberofdays(int n,int year) {     switch(n)     {     case 0:         return(31);     case 1:     {         if(year%400==0 || (year%4==0 && year%100!=0))             return(29);         else             return(28);     }     case 2:  ...

calendar program odd days method

                                     calendar program odd days method           first visit code first fall understand odd method please flow my simple example              Remember  this two logics months odd code and year odd code year code  code                  days                                                                0 odd days for  0                      Sunday                                               ...

circular linked list

                    circular linked list           method one  #include<stdio.h> #include<stdlib.h> struct node {         int data;         struct node *next; }*start=NULL; enum op{INSERT=1,DELETE,TRAVERSE,EXIT}; enum op1{BEG=1,POS,END}; int count =1; void insert_beg(int data) {         struct node *newnode = (struct node *)malloc(sizeof(struct node));         newnode->data = data;         newnode->next = NULL;         if(start == NULL)         {                 start = newnode;   start->next = start;         }  ...

pointer and dyamaic memory

  circular queue and queue program and pointer #include<stdio.h> #include<stdlib.h> int main() {     int i;        int *pr;        pr=(int *) calloc(1,sizeof(int));     if(pr==NULL)     {         printf("full");         exit(2);     }     for(i=1;i<6;i++)     {             *(pr+i)=i*2;         printf("%d\t",*(pr+i));                 }     printf("%d",sizeof(*pr)); } #include<stdio.h> void fun(char a[],char b[]) {     printf("entrerd");     if(a==b)     printf("compare");     else      ...