By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,538 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,538 IT Pros & Developers. It's quick & easy.

Syntax error

P: 4
Hi can anyone please help i have an error which says declaration syntax error at the main function thanks


# include<stdlib.h>
# include<conio.h>
# include<stdio.h>
# define MAXREN 3
# define MAXCOL 4
void ini_renmatdin (int*);
void ini_colmatdin (int *)

void main (void)
{
clrscr();
int *ap_mat;
int exito;
int S;
ap_mat=(int*)malloc(MAXREN*MAXCOL);
if(!ap_mat)
{
printf("\ ERROR: No hay espacio");
}
else
{
printf("\n Elija una opcion");
printf("\n 1.- Inicializar matriz por renglon, 2.- Inicializar matriz por columna");
scanf("%d",S);
switch(S)
{

case 1:

ini_renmatdin (ap_mat);
printf ("Exito si se inicializo");
break;

case 2:
ini_colmatdin (ap_mat);
printf ("Exito si se inicializo");
break;


default:printf("ERROR intente con los valores indicados en el menu");
}

}




getch();
}


void ini_renmatdin (int *ap_mat)
{
/*Inicializar una matriz por renglon en un arreglo dinamico*/
int *ap_aux;
ap_aux=ap_mat;
while(ap_aux<=(ap_mat+(MAXREN*MAXCOL-1)))
{
*ap_aux=0;
ap_aux=ap_aux+1;
}

}


void ini_colmatdin (int *ap_mat)
{
/*Inicializar una matriz por columna en un arreglo dinamico*/
int *ap_ren;
int *ap_col;
ap_col=ap_mat;
ap_aux=ap_mat;
while(ap_col<=(ap_mat+(MAXCOL-1)))
{
ap_ren=ap_col;
while(ap_ren<=(ap_mat+(MAXREN+MAXCOL-1)))
{
*ap_ren=0;
ap_ren=ap_ren+MAXCOL;
}
ap_col=ap_col+1;
}

}
Sep 18 '07 #1
Share this Question
Share on Google+
3 Replies


P: 10
void ini_colmatdin (int *)

You're missing a semicolon.
Sep 18 '07 #2

P: 4
oh thanks this thingss happen =S
Sep 18 '07 #3

P: 10
No worries, I just spend 10 minutes wondering why:

void void(main){
}

wouldn't compile!
Sep 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.