Can someone please tell me what im doing wrong in this program..im gettin a compiler error saying:
C:\Dev-Cpp\projects\proto.cpp In function `int main(int, char**)':
46 C:\Dev-Cpp\projects\proto.cpp a function-definition is not allowed here before '{' token
46 C:\Dev-Cpp\projects\proto.cpp expected `,' or `;' before '{' token
C:\Dev-Cpp\projects\Makefile.win [Build Error] [proto.o] Error 1
The error is occuring at the function definition..
The code is:
#include <stdio.h>
#include <cstdlib>
#include <iostream>
using namespace std;
void print(int x); /* Function prototype */
int main(int argc, char *argv[])
{
int i, j, m = 0, IP[64],P[64] = {0,1,0,0,0,1,0,0,
0,1,1,1,0,1,0,0,
0,1,0,1,0,1,0,0,
0,1,1,1,0,1,0,0,
0,1,0,0,0,1,0,0,
0,1,1,1,0,1,0,0,
0,1,0,0,0,1,0,0,
0,1,1,1,0,1,0,1,};
void printtable(int x); /* function call */
/*INITIAL PERMUTATION*/
int k = 57;
for (i = 0; i<4; ++i) {
for (j=k; j>=1; j=j-8){
IP[m]=P[j];
printf("%2d", IP[m]);
++m;
}
k=k+2;
}
printf("\n");
k = k-9;
for (i = 0; i<4; ++i) {
for (j=k; j>=0; j=j-8){
IP[m]=P[j];
printf("%2d", IP[m]);
++m;
}
k=k+2;
}
void print(int x) /* Function definition */
{
int x;
for (x=0;x<10;x++){
printf("%d",x);
printf("n");
}
}
}
Thanks
PS Its a DEV C++ COMPILER..