Declaring a function inside a function?
Posted
by nunos
on Stack Overflow
See other posts from Stack Overflow
or by nunos
Published on 2010-03-20T19:55:46Z
Indexed on
2010/03/20
20:01 UTC
Read the original article
Hit count: 288
I have came across the following code, and being a c beginner, I came here for your help.
This function is from a c implmentation of a queue.
Bool queuePut(Queue *q, char c)
{
void beep();
if (queueFull(q))
{
beep();
return false;
}
//do stuff
return true;
}
So, I am getting a strange error with gcc on the void beep(). Can someone please explain me what is this, declaring a function inside a function. Or is it the void beep() simply out of place? I was given this code and there's always the possibility that it isn't correct.
Thanks.
© Stack Overflow or respective owner