C expected identifier or ‘(’ before ‘{’ : <p>The point of the exercise (for university) is to create a function that calculates the perimeter of a triangle once given the coordinates of its 3 corners.
I am a beginner at C and after some work I have managed to create a code that more or less does its intended job, however i have stumbled upon the following error: </p>

<p>trperim.c:25:1: error: expected identifier or ‘(’ before ‘{’ token
 {
 ^
trperim.c:31:58: error: expected identifier or ‘(’ before ‘{’ token
 double trperim(double r1[2], double r2[2], double r3[2]);{</p>

<p>I have been unable to solve this, and so I turn to this community.  Any help would be greatly appreciated.</p>

<pre><code>#include&lt;stdio.h&gt;
#include&lt;math.h&gt;
double trperim(double r1[2], double r2[2], double r3[2]);
double norm(double r[2]); 

main()
{
double r1[2], r2[2], r3[2];
printf("Ingrese las coordenadas del primer vertice en x:");
scanf("%lf",&amp;r1[0]);
printf("Ingrese las coordenadas del primer vertice en y:");
scanf("%lf",&amp;r1[1]);
printf("Ingrese las coordenadas del segundo vertice en x:");
scanf("%lf",&amp;r2[0]);
printf("Ingrese las coordenadas del segundo vertice en y:");
scanf("%lf",&amp;r2[1]);
printf("Ingrese las coordenadas del tercer vertice en x:");
scanf("%lf",&amp;r3[0]);
printf("Ingrese las coordenadas del tercer vertice en y:");
scanf("%lf",&amp;r3[1]);
printf("El perimetro del triangulo es %f\n", trperim(r1,r2,r3));
}

double norm(double r[2]);
{
double modulo, r[2];
modulo=sqrt(pow(r[0],2)+pow(r[1],2));
return modulo;
}

double trperim(double r1[2], double r2[2], double r3[2]);{
double nr1, nr2, nr3, p;
nr1=norm(r1-r2);
nr2=norm(r2-r3);
nr3=norm(r3-r1);
p=nr1+nr2+nr3;
return p;
}
</code></pre>
