ช่วยดูโค้ดภาษาซีให้หน่อยครับว่ามันผิดตรงไหน

แนะนำ สอบถาม ภาษา C สำหรับผู้เริ่มต้น

Moderator: phpbb, mindphp, ผู้ดูแลกระดาน

ตอบกลับโพส
allofeve
phpBBThailand Newbie
phpBBThailand Newbie
โพสต์: 1
ลงทะเบียนเมื่อ: 06 ก.ย. 2013, 21:55

ช่วยดูโค้ดภาษาซีให้หน่อยครับว่ามันผิดตรงไหน

โพสต์ โดย allofeve »

โค้ด: เลือกทั้งหมด

#include <stdio.h>
#include <conio.h>

// function variable
void mul_pro();

// sub program
void mul_pro()
{
	clrscr();
	int i,n;

	printf("Mother Multiplication \n");
	printf("enter number : ");
	scanf("%d",&n);
	
	clrscr();
	printf("== %d == \n",n);
	
	for(i=0; i<=n; i++)
	{
		printf("%d x %d = %d \n",n,i,n*i);
	}
}

// main program
void main()
{
	// data type variable
	int c;

	printf("1 : Multiplication Program \n");
	printf("select program : ");
	scanf("%d",&c);
	
	if(c == 1)
	{
		mul_pro();
	}
}
---------- C++ Compiler ----------
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.c:
Error E2140 test.c 17: Declaration is not allowed here in function mul_pro
Warning W8065 test.c 47: Call to function 'mul_pro' with no prototype in function main
*** 1 errors in Compile ***

Output completed (0 sec consumed) - Normal Termination
ตอบกลับโพส

ย้อนกลับไปยัง

ผู้ใช้งานขณะนี้

กำลังดูบอร์ดนี้: 5 และ บุคคลทั่วไป 0 ท่าน