[Freeciv-Dev] Re: TODO
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Jules Bean (jules@xxxxxxxxxxxxxxxxxxxxxxxxx) wrote:
> 'on-the-fly' struct creation is not possible.
>
> Instead use a 'constructor' function
>
> struct locus make_locus(int x,int y) {
> struct locus l;
> l.x=x; l.y=y;
> return l;
> }
jekyll:~$ cat foo.c
#include <stdio.h>
struct foo {
int x;
int y;
};
int main(void) {
struct foo bar = { 1, 2 };
printf ("%d\n", bar.x + bar.y);
return 0;
}
jekyll:~$ gcc -O -g -Wall -ansi -pedantic -o foo foo.c
jekyll:~$ ./foo
3
--
Greg Wooledge | "Truth belongs to everybody."
wooledge@xxxxxxxxxxx | Red Hot Chili Peppers
http://www.kellnet.com/wooledge/ |
pgp5fzRAD5bh_.pgp
Description: PGP signature
- [Freeciv-Dev] Re: TODO, (continued)
- [Freeciv-Dev] Re: TODO, Jules Bean, 2000/09/22
- [Freeciv-Dev] Re: TODO, Raimar Falke, 2000/09/22
- [Freeciv-Dev] Re: TODO, Jules Bean, 2000/09/22
- [Freeciv-Dev] Re: TODO, Daniel Sjölie, 2000/09/22
- [Freeciv-Dev] Re: TODO, Jeff Mallatt, 2000/09/22
- [Freeciv-Dev] Re: TODO, Jules Bean, 2000/09/22
- [Freeciv-Dev] Re: TODO, Jeff Mallatt, 2000/09/22
- [Freeciv-Dev] Re: TODO, Raimar Falke, 2000/09/22
- [Freeciv-Dev] Re: TODO, Daniel Sjölie, 2000/09/22
- [Freeciv-Dev] Re: TODO, Gaute B Strokkenes, 2000/09/22
- [Freeciv-Dev] Re: TODO,
Greg Wooledge <=
- [Freeciv-Dev] Re: TODO, Gaute B Strokkenes, 2000/09/22
- [Freeciv-Dev] Re: TODO, Erik Sigra, 2000/09/22
- [Freeciv-Dev] Re: -ansi -pedantic, was Re: TODO, David Pfitzner, 2000/09/22
[Freeciv-Dev] Re: TODO, David Pfitzner, 2000/09/24
|
|