Copy a character array in another character array using pointers and without using inbuilt function

#include<stdio.h>
#include<string.h>
main()
{
    char str1[100],str2[100],*a,*b;
    int i,k,l,m;
    printf("Enter string 1\n");
    gets(str1);
    printf("Enter string 2\n");
    gets(str2);
    m=strlen(str1);
    k=strlen(str1);
    l=strlen(str2);
    a=&str1;
    b=&str2;
    for(i=0;i<l;i++)
    {
        *(a+i)=*(b+i);
    }
    printf("Copied String - ");
    for(i=0;i<l;i++)
    {
        printf("%c",*(a+i));
    }

}

OUTPUT:

Copy

To perform following operations: -> Addition of two matrices, Transpose & Sum of upper and lower triangular

Program:

#include<stdio.h>
void main()
 {
   int i,j,c,r,k;
   int a[20][20],b[20][20],ma[20][20],choice;
   printf("Enter an operation");
   printf("\n1. Addition of matrices\n2. Transpose\n3. Upper triangular matrix\n4. Lower triangular matrix\n");
 scanf("%d",&choice);
switch(choice)
{
    case 1:
         printf("\nEnter the value for row and column: ");
   scanf("%d%d",&c,&r);
   printf("\nEnter the value for matrix A\n");
   for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
        {
         scanf("%d",&a[i][j]);
        }

     }
   printf("\nEnter the value for matrix B\n");
   for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
        {
          scanf("%d",&b[i][j]);
        }

     }
      printf("\nMatrix A is\n");
     for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          printf("%d",*(*(a+i)+j));
         }
       printf("\n");
     }
      printf("\nMatrix B is:\n");
     for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          printf("\t%d",*(*(b+i)+j));
         }

       printf("\n");
     }

   for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          *(*(ma+i)+j)=*(*(a+i)+j)+*(*(b+i)+j);
         }}
          printf("\n\tThe addition matrix is:\n");
   for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          printf("\t%d",*(*(ma+i)+j));
         }
       printf("\n");
     }
     break;
  case 2:
      printf("\n\tEnter the value for row and column:  ");
   scanf("%d%d",&c,&r);
   printf("\n\tEnter the value for matrix \n");
   for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
        {
         scanf("%d",&a[i][j]);
        }

     }
     printf("\n\t matrix is:\n");
     for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          printf("\t%d",*(*(a+i)+j));
         }
       printf("\n");
     }
     for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
        { *(*(b+i)+j)=*(*(a+j)+i);
        }
     }
      printf("\n\t Transpose of the matrix is:\n");
     for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          printf("\t%d",*(*(b+i)+j));
         }
       printf("\n");
     }
     break;
  case 3:
      printf("\n\tEnter the value for row and column:  ");
   scanf("%d%d",&c,&r);
   printf("\n\tEnter the value for matrix \n");
   for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
        {
         scanf("%d",&a[i][j]);
        }

     }
     printf("\n\t matrix is:\n");
     for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          printf("\t%d",*(*(a+i)+j));
         }
       printf("\n");
     }
     printf("Upper triangular matrix is:\n");
      for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         { if(i>=j)
         *(*(a+i)+j)=0;
         }
         }
        for(i=0;i<c;i++)
        {
            for(j=0;j<r;j++)
        {
            printf("%d  ",*(*(a+i)+j));
        }
        printf("\n");
        }

         break;
    case 4:
         printf("\n\tEnter the value for row and column:  ");
   scanf("%d%d",&c,&r);
   printf("\n\tEnter the value for matrix \n");
   for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
        {
         scanf("%d",&a[i][j]);
        }

     }
     printf("\n\t matrix is:\n");
     for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         {
          printf("\t%d",*(*(a+i)+j));
         }
       printf("\n");
     }

     printf("lower triangular matrix is:\n");
       for(i=0;i<c;i++)
     {
       for(j=0;j<r;j++)
         { if(i<=j)
         *(*(a+i)+j)=0;
         }
         }
        for(i=0;i<c;i++)
        {
            for(j=0;j<r;j++)
        {
            printf("%d  ",*(*(a+i)+j));
        }
        printf("\n");
        }
         break;
  }
 }

OUTPUT:

Matrix operations