diff --git a/serial.c b/serial.c new file mode 100644 index 0000000..6fe60d9 --- /dev/null +++ b/serial.c @@ -0,0 +1,88 @@ +#include +#include + + +void main(){ + printf("Hello I am maria \n"); + + //Read from file of adjacency matrix + FILE *adjm; + + int x; + adjm = fopen("adj_matrix.txt", "r+"); + if(!adjm){ + printf("Error opening file \n"); + exit(0); + } + + //Read dimensions of file (square) + int m, count=0; + while((m=fgetc(adjm))) { + /* break if end of file */ + if(m == EOF) break; + /* otherwise add one to the count of that particular character */ + if(m=='\n'){ + count+=1; + } + } + printf("Line count of matrix is %d \n", count); + int d = count; + int i,j; + + // Put values in matrix A + int** A = malloc(d*sizeof(int *)); + for( i=0; i