lỗi không complie được

mọi người cho hỏi em bị lỗi gì ạ

#include<stdio.h>

void main()
{
int a, b, c, sum;

printf(“\nEnter any three numbers: ”);
scanf(“%d %d %d”, &a, &b, &c);

sum = calculatesum(a, b, c);

printf(“\nSum = %d”, sum);	
}

calculatesum(int x, int y, int z)
{
	int d;

	d = x + y + z;
	return (d);
}
int calculatesum(int x, int y, int z)
{
	int d;
	d = x + y + z;
	return (d);
}

chua khai bao nguyen mau ham truoc main

calculatesum(int x, int y, int z)
1 Like

em F9 thì nó thông báo: “calculatesum” was not declared in this scope ở dòng “sum = calculatesum(a, b, c);”

Như anh @Gio đã nói:
1/ Phải khai báo nguyên mẫu hàm:

#include<stdio.h>
calculatesum(int x, int y, int z);

2/ Đem hàm calculatesum lên trên hàm main()

2 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?