Saturday, 30 November 2013

C Program to Perform Matrix addition Using Dynamic Memory Allocation


  This post provides the C Program to add two matrices. The difference with this program is that memory for the matrices is allocated dynamically. This elegant program was written by a friend and that too by taking just a few minutes. 

Figure Below Shows a Sample Output

  Let int * a; be a pointer, r1 be the number of rows of the matrix and c1 be the number of columns of the matrix, then memory allocation is done as follows.

a=(int *)malloc(r1*c1*sizeof(int));


Friday, 29 November 2013

LaTeX: Presentation on Miscellaneous Topics


  This post provides a presentation on miscellaneous LaTeX topics. The presentation discusses a few useful topics in LaTeX. Download the file and view it in full screen mode or presentation mode.

Click here to download the Presentation.

Click here to download watermarking.tex.

Click here to download href.tex.

Click here to download newcommand.tex.

LaTeX: Presentation on Beamer


  This post provides a presentation on Beamer. Beamer is a LaTeX document class used to create presentations. The presentation might be sufficient for Beginners in Beamer. Download the presentation and view it in full screen mode or presentation mode.

LaTeX: Presentation on Math Mode


  This post provides a presentation on the Math mode of LaTeX. The contents discussed in the presentation gives an introduction to the basics of Math mode. For LaTeX Beginners this might be a good introduction to Math mode. Download the presentation and view it in full screen mode or presentation mode.

Click here to download the Presentation.

C Program to Add Two Matrices Using Pointers


  The C Program given with this post finds the sum of two matrices using pointers.
The prototype of function addmat is shown below.

 int (*addmat(int (*p)[MAX], int (*q)[MAX]))[MAX];

The function addmat accepts two pointers to one dimensional arrays with size MAX as arguments and returns a pointer to a one dimensional array with size MAX.

Figure Below Shows a Sample Output


C Program to Print the Upper and Lower Triangles of a Matrix


  The C Program provided with this post prints the upper and lower triangles of a matrix.

Figure Below Shows a Sample Output