Ошибка "expected identifier or ‘(’ before ‘{’ token" - C (СИ)
Формулировка задачи:
Помогите исправить функцию
Вот такая ошибка: prog.c:25:1: error: expected identifier or ‘(’ before ‘{’ token
{
^
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int kek(double x1,double x2,double y1,double y2,double a,double b,double V)
{
printf("Enter the x1\n");
scanf("%lf",&x1);
printf("Enter the x2\n");
scanf("%lf",&x2);
printf("Enter the y1\n");
scanf("%lf",&y1);
printf("Enter the y2\n");
scanf("%lf",&y2);
a = (x1*x2+y1*y2);
b = sqrt(x1*x1+y1*y1)*sqrt(x2*x2+y2*y2);
V = a/b ;
printf("%lf\n",V);
return 0;
}
{
int x1,x2,y1,y2,a,b,V;
V = kek(x1,x2,y1,y2,a,b)
}Решение задачи: «Ошибка "expected identifier or ‘(’ before ‘{’ token"»
textual
Листинг программы
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
double func(double, double, double, double);
int main()
{
double x1,x2,y1,y2;
printf("Enter the x1\n");
scanf("%lf",&x1);
printf("Enter the x2\n");
scanf("%lf",&x2);
printf("Enter the y1\n");
scanf("%lf",&y1);
printf("Enter the y2\n");
scanf("%lf",&y2);
printf("%lf\n",func(x1,x2,y1,y2));
return 0;
}
double func(double x1, double x2, double y1, double y2){
double a,b,V;
a = (x1*x2+y1*y2);
b = sqrt(x1*x1+y1*y1);
return V = a/(b*b);
}