can I use a function (written by myself) in writing a new function?
Printable View
can I use a function (written by myself) in writing a new function?
Yes.
Sure. Is this what you meant:
Obviously, you may make this as complicated as you like, and output it to a file if you like.Code:void func()
{
printf("void newfunc()\{\n\tprintf(\"Hello, World\\n\");\n}\n");
}
[I know, this is probably NOT what you meant to ask for, but I couldn't resist answering a different one... ;)]
--
Mats
then, I should define which one first?
Doesn't really matter - it's a style issue. If you are only calling one from the other, then I personally prefer to put the outermost (called last) first, and then work in towards main. But I starting programming in Pascal many years ago, and in Pascal you are not meant to forward declare function unless one calls the other recursive manners.
--
Mats