Skip to main content

Search This Blog

matrix multiplication in c using functions and pointers

 #include <stdio.h> #define ROWS 3 #define COLS 3 void matrixMultiply(int *mat1, int *mat2, int *result, int rows1, int cols1, int cols2) {     int i, j, k;     // Multiplying matrices     for (i = 0; i < rows1; i++) {         for (j = 0; j < cols2; j++) {             *(result + i * cols2 + j) = 0;             for (k = 0; k < cols1; k++) {                 *(result + i * cols2 + j) += *(mat1 + i * cols1 + k) * *(mat2 + k * cols2 + j);             }         }     } } void displayMatrix(int *mat, int rows, int cols) {     int i, j;     // Displaying matrix     for (i = 0; i < rows; i++) {         for (j = 0; j < cols; j++) {             printf("%d\t", *(mat + i * cols + j)); ...

What is Compiler in C




What is Compiler

Compile is a converting programming language into machine language.we are written a simple English language and computers do not understand the English language. 
The source file written in the code human-readable ASCII text file (Source File).  The computer read 0 and 1 format.
The compiler human-readable code or text file, image file, and any file convert into machine language after the processing computer in this language.

it got to have complied in machine language because computer read-only binary number format is 01010101.
The compiler converts the  ASCII text file (Source File) human-readable into machine language.
Compiler may be a software which converted program file into binary format in a single step.
In simple words, the compiler may be a software which may take input from other language and converted into Low-Level Language (Machine Language) machine dependent language.
Process of Translation
You have written the program subsequent step is to save lots of the program during a file with extension. c.
This program is in application-oriented language. But this language isn't understood by the pc. So, the subsequent step is to convert the application-oriented language program (source code) to machine language (object code). This task is performed by a software or program referred to as a compiler.
Every language has its own compiler that converts the ASCII text file to code. The compiler will compile the program successfully if the program is syntactically correct.
The object code won't be produced. 
A compiler is system software that converts programming language code into binary format in single steps. In other words the compiler is a system software that can take input from any other programming language and convert it into a language-dependent on a lower level machine.



Comments

Popular posts from this blog

Write a C program (use a switch statement for selection) to add or subtract 2 matrices having order 3 x 3, depending upon the choice made by the user

Write a C program (use a switch statement for selection) to add or subtract 2 matrices having order 3 x 3, depending upon the choice made by the user. MCS-011 : PROBLEM SOLVING AND   PROGRAMMING (June, 2017) c program for matrix operations using switch case, c program for addition and subtraction of two matrices, algorithm for matrix addition in c program #include <stdio.h> #include<conio.h> void main() {     int first_matrix[3][3], second_matrix[3][3], sub_of_two_matrix[3][3],sum_of_two_matrix[3][3], i, j;      int oprater;      clrscr(); //Enter First Matrix      printf("\nEnter elements of 1st matrix:\n");     for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) {     printf("Enter element a%d%d: ", i + 1, j + 1);     scanf("%d", &first_matrix[i][j]); } //Enter Second Matrix      printf("Enter elements of 2nd matrix:\n");     for (i = 0;...

how to multiple number enter and sort the Ascending Order

how to multiple number enter and sort the Ascending Order #include<Stdio.h> #include<conio.h> int main(void){ int a[10],b,c,n,i,j; printf("Enter number of elements :"); scanf("%d",&n); for(i=1; i<=n; i++){ printf("Enter any number :"); scanf("%d",&a[i]); } for(i=1; i<=n; i++){ for(j=i+1; j<=n; j++){ if(a[i]>a[j]){ b=a[i]; a[i]=a[j]; a[j]=b; } } } printf("Ascending Order :\n"); for(i=1; i<=n; i++){ printf("%d\t",a[i]); } getch(); }

Contact Form

Name

Email *

Message *