|
# include <stdio.h>
typedef enum
{
Abe
,
Bob
,
Cat
,
Deb
,
MAX /* Helps to bounds-check the value */
} UserEnum ;
typedef struct
{
UserEnum From ;
char* Text ;
} Message ;
int
main
(
int argc
,
char* argv[]
)
{
int result = 0 ;
if ( argc > 1 )
{
Message m ;
m.From = Bob ;
m.Text = argv [ 1 ] ;
printf ( "%d says \"%s\"\n" , m.From , m.Text ) ;
/* This line would cause an error */
// printf ( "%s says \"%s\"\n" , m.From , m.Text ) ;
}
return ( result ) ;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.