PIPS
ddot_i.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "tools.h"
+ Include dependency graph for ddot_i.c:

Go to the source code of this file.

Functions

void ddot_i (int n, int b[n], int c[n], int *r)
 
int main (int argc, char **argv)
 

Function Documentation

◆ ddot_i()

void ddot_i ( int  n,
int  b[n],
int  c[n],
int r 
)

Definition at line 5 of file ddot_i.c.

6 {
7  int i;
8  int a=0;
9  for(i=0; i<n; ++i)
10  a += b[i] * c[i] ;
11  *r = a;
12 }

Referenced by main().

+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file ddot_i.c.

15 {
16  int i,n;
17  int a, (*b)[n], (*c)[n];
18  if (argc < 3)
19  {
20  fprintf(stderr, "Usage: %s size data_file\n", argv[0]);
21  return 1;
22  }
23  n = atoi(argv[1]);
24  b = malloc(n * sizeof(int));
25  c = malloc(n * sizeof(int));
26  init_data_file(argv[2]);
27  init_data_int(b,n);
28  init_data_int(c,n);
30  ddot_i(n,*b, *c, &a);
31  printf("%d\n",a);
32  free(b);
33  free(c);
34  return 0;
35 }
void ddot_i(int n, int b[n], int c[n], int *r)
Definition: ddot_i.c:5
void * malloc(YYSIZE_T)
void free(void *)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
int printf()
void close_data_file()
Definition: tools.c:48
void init_data_file(const char *data_file)
Definition: tools.c:36
int init_data_int(int *ptr, const unsigned int n)
Definition: tools.c:141

References close_data_file(), ddot_i(), fprintf(), free(), init_data_file(), init_data_int(), malloc(), and printf().

+ Here is the call graph for this function: