c - Main is usually a function? -
i question because doing basic program, , have warning when compilate it, says "warning: 'main' function"" , make error of syntaxis in same line. program palindrome, in spanish "capicua". help. program in c.
int t=10; int cargarvector(char vec[t]); int escapicua(char vec[t]) int main() { //here error!! char vec[t]; cargarvector(vec); escapicua(vec); return 0; } int cargarvector(int vec[t]) { int i=0; printf("ingrese letra"); aux=getche(); while(aux!='.'&&i<t) { while(aux<'a'||aux>'z') { printf("error, ingrese letra del abcdario") aux=getche(); } vec[i]=aux; i++; printf("ingrese letra"); aux=getche(); } r=i; return 0; } int escapicua(char vec[t]) { int i,c; for(i=0;i<(t/2),i++) { if(vec[i]!=vec[(t-1)] { c++ } if(c>0) { printf("no es capicua"); } else { printf("es capicua") } } return 0; }
this because forgot put semicolon after forward declaration on previous line:
int escapicua(char vec[t]); // here ------- ^
note array size , parameter names ignored in function declarations, declaration below equivalent:
int escapicua(char[]);
Comments
Post a Comment