Local function def's are illegal errors in my code.

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

void rpt(char in[30]) //Repeat Function

{

int a, out = 0, b, c;
printf( "Enter a sentence, please. \n");
gets(in);
for(a = 0; in[a] != '\0'; a++)
{
out = out + 1;

}
for(c = 0; c < out; c++)
{
for(b = 0; b <out; b++)
{
printf("%c", in[b]);
}



getche ();
return;
}

void avg(char in[30]) //Average number of letters per word function

{
char in[30];
int a;
float avg, out = 0, b = 0;
printf( "Enter a sentence, please. \n");
gets(in);
for(a = 0; in[a] != '\0'; a++)
{

if((in[a] >= 65 && in[a] <= 90) || (in[a] >= 97 && in[a] <= 121))

out = out + 1;

if(in[a] == ' ')
b = b + 1;

}
avg = (out) / (b + 1);
printf("%f", avg);
getche();
return avg;
}

void upper(char in[30]); //Uppercase letters function

{
char in[30];
int a, out = 0;
printf("Enter a sentence, please. \n");
gets(in);
for (a = 0; in[a] != '\0'; a++)
{
if ( in[a] >= 65 && in[a] <= 90 )

out++;
}
printf("\n\tNumber of uppercase letters in your sentence: %d", out);
getche();
return;
}

void menu(char in[30]) //Menu function
{
char in[30], out;
int a;
do
{
printf("Enter a sentence with a maximum of 30 characters please.");
gets(in);
printf("Select a function, please.\n1=repeat_functıon\n2=number_of_uppercase_functıon\n3=average_number_of_letters_per_word\n4=functıon_most_repeated_letter\n");
scanf("%d",&a);

switch (c)
{
case 1:
rpt(char in[30]);
break;
case 2:

case 3:
avg(char in[30]);

case 4:
}

printf("\nPress e or E to exit. ");
scanf("%c", &out);

while (out != 'e' && out !='E');
}

};

This is my code, and it gives me the following errors:
1> c:\....22_proj2.cpp(33) : error C2601: 'avg' : local function definitions are illegal
1> c:\....22_proj2.cpp(8): this line contains a '{' which has not yet been matched
1> c:\....22_proj2.cpp(75) : error C2601: 'menu' : local function definitions are illegal
1> c:\....22_proj2\18050127622_proj2.cpp(8): this line contains a '{' which has not yet been matched
1> c:\....22_proj2\18050127622_proj2.cpp(105) : fatal error C1075: end of file found before the left brace '{' at 'c:\....22_proj2.cpp(8)' was matched

Thanks for helping.
You forgot a closing brace } at the end of your rpt function.
(That's why it says "this line contains a '{' which has not yet been matched".)
i solved it, but i now have the error "missing function header" at line 54; in the upper function.
Topic archived. No new replies allowed.