How to allocate vector greater than 2Gb?

I need assistance on a C program i can't seem to figure out.

  • prob2(): By using a pointer to pointer **A and the function calloc() allocate the memory for the 4x4 matrix A[][]. By using a pointer *b and the function malloc() allocate the memory for the 4-dimensional vector b[]. Read the components of A and b from the given input file matrix.dat. The last line of the input file contains the components of b. The rows of matrix A are the first four lines of the input file. Print the components of A[][] row by row, and the components of b[]. Using the function gauss() given in the lecture notes week9.txt, solve the system of linear algebraic equations A[][]*x[]=b[]. Print the components of the solution vector x[]. Calculate and print the length of this vector. Free the allocated memory.

  • Answer:

    void prob2(void) { //printf("Put your solution for problem 2 here: "); char inputs[81]; int i, j, k, lines; double **A, *b, vec[4]; FILE *input; input = fopen("matrix.dat", "r"); while(fgets(inputs, 81, input) != NULL) { lines++; A = (double **)malloc(4*sizeof(double *)); for(i = lines; i

Tipuk at Answerbag.com Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.