Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sreesasu
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <stdio.h> #include<stdlib.h> #include<time.h> void multiply(int siz,int frst[][siz], int scnd[][siz], int xt[][siz]); int main() { FILE* newfile; newfile=fopen("file.csv","w"); for(int size=1;size<=1000;size+=10){ int siz=size; double time; clock_t start; int frst[siz][siz]; int scnd[siz][siz]; int p,q; for(p=0;p<siz;p++) { for(q=0;q<siz;q++) { frst[p][q]=1; scnd[p][q]=1; } } int xt[siz][siz]; int i, j; start=clock(); for(i=0;i<5;i++){ multiply(size,frst, scnd, xt); } time= (double)(clock()-start)/(CLOCKS_PER_SEC*5); printf("\nsize:%d time:%.12f\n",size,time); fprintf(newfile,"%d,%d,%d,%.12f\n",siz,siz*siz,3*siz*siz,time); } fclose(newfile); return 0; } void multiply(int siz,int frst[][siz], int scnd[][siz], int xt[][siz]) { int i, j, k; for (i = 0; i < siz; i++) { for (j = 0; j < siz; j++) { xt[i][j] = 0; for (k = 0; k < siz; k++) xt[i][j] += frst[i][k]*scnd[k][j]; } } }
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.24 sec, absolute running time: 5.38 sec, cpu time: 8.94 sec, memory peak: 3 Mb, absolute service time: 5,63 sec
edit mode
|
history
|
discussion
Error(s):
Kill signal (SIGKILL)