Understanding Packages
Lennart Sorensen
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Tue Apr 20 13:33:04 UTC 2004
On Sun, Apr 18, 2004 at 10:26:55PM -0400, Geoffrey Hunter wrote:
> I guess that much Linux software is written in C, and I've noticed that
> C doesn't allow functions to be defined (nested) within other functions; MAIN
> and all the functions that it calls, and all the functions that they call, are
> at the same hierarchical level, with data/results being passed between them
> via parameters of the functions. I guess that this could be the explanation
> for why applications come as a package of C functions, even though only one
> (or a few) of the many functions that comprise the package are called
> (callable) by the user ?
So what does this look like to you:
#include <stdio.h>
#include <strings.h>
int main() {
int a,b;
void callMe(int x) {
printf("callMe called with %d\n",x);
}
a=4;
b=6;
callMe(9);
printf("a is %d\n",a);
callMe(10);
printf("b is %d\n",b);
callMe(1);
return 0;
}
No nesting in C? Really?
Lennart Sorensen
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list