B
Bill Cunningham
I've been having problems with structs for awhile now. I've tried
everything this is the latest errors from Bash's stdout and the source I've
tried. Am I getting something backwards here?
#include <stdio.h>
struct cat {
char *name;
char *color;};
struct cat kitty1,kitty2;
kitty1={"striper","striped"};
kitty2={"spook","black"};
main() {
printf("%s %s\n",kitty1.name,kitty2.name);}
----
p.c:9: error: conflicting types for 'kitty1'
p.c:7: error: previous declaration of 'kitty1' was here
p.c:9: warning: initialization makes integer from pointer without a cast
p.c:9: warning: excess elements in scalar initializer
p.c:9: warning: (near initialization for `kitty1')
p.c:9: warning: data definition has no type or storage class
p.c:10: error: conflicting types for 'kitty2'
p.c:7: error: previous declaration of 'kitty2' was here
p.c:10: warning: initialization makes integer from pointer without a cast
p.c:10: warning: excess elements in scalar initializer
p.c:10: warning: (near initialization for `kitty2')
p.c:10: warning: data definition has no type or storage class
p.c: In function `main':
p.c:13: error: request for member `name' in something not a structure or
union
p.c:13: error: request for member `name' in something not a structure or
union
Bill
everything this is the latest errors from Bash's stdout and the source I've
tried. Am I getting something backwards here?
#include <stdio.h>
struct cat {
char *name;
char *color;};
struct cat kitty1,kitty2;
kitty1={"striper","striped"};
kitty2={"spook","black"};
main() {
printf("%s %s\n",kitty1.name,kitty2.name);}
----
p.c:9: error: conflicting types for 'kitty1'
p.c:7: error: previous declaration of 'kitty1' was here
p.c:9: warning: initialization makes integer from pointer without a cast
p.c:9: warning: excess elements in scalar initializer
p.c:9: warning: (near initialization for `kitty1')
p.c:9: warning: data definition has no type or storage class
p.c:10: error: conflicting types for 'kitty2'
p.c:7: error: previous declaration of 'kitty2' was here
p.c:10: warning: initialization makes integer from pointer without a cast
p.c:10: warning: excess elements in scalar initializer
p.c:10: warning: (near initialization for `kitty2')
p.c:10: warning: data definition has no type or storage class
p.c: In function `main':
p.c:13: error: request for member `name' in something not a structure or
union
p.c:13: error: request for member `name' in something not a structure or
union
Bill