Skip to content

Instantly share code, notes, and snippets.

@tuliopaim
Created June 19, 2018 12:40
Show Gist options
  • Select an option

  • Save tuliopaim/0205a64d3cfdc40d503fc868836275cb to your computer and use it in GitHub Desktop.

Select an option

Save tuliopaim/0205a64d3cfdc40d503fc868836275cb to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
void mult2(int a[], double b[], int n);
void mult3(int a[], double b[], int n) {
int *pint;
double *pdouble;
for (pint = a, pdouble = b; n-- ; pint++, pdouble++) {
*pdouble = (double)*pint * 2.0;
}
}
double sum(double v) {
int i;
double a2[4];
int a1[4] = {1,2,3,4};
mult2(a1, a2, 4);
for (i = 0; i < 4; i++)
v += a2[i];
if (v > 10.0)
printf("Maior que 10: %f\n", v);
return v;
}
int main() {
printf("%f\n", sum(1.0));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment