Yes, I was referring to your post where you mentioned that sizeof on a function parameter that is a pointer won't work.
Yes, I was referring to your post where you mentioned that sizeof on a function parameter that is a pointer won't work.
if this is what your talking about, it did what i wanted it to do.. or so ithink it did
Code:length = strlen(rec->pass_name); for( i = 0; i < length; i++ ) printf( "Seat [%i] is assigned to %s \n\n", rec[ i ].seat_number , rec[ i ].pass_name );i am aware that i went about this whole project if you will the wrong way.. i think i set up the struct wrong to begin with..Code:Seat [21] is assigned to DR Power Seat [2] is assigned to Green Lantern Seat [30] is assigned to The Flash Seat [7] is assigned to Super Girl Seat [12] is assigned to Phoenix Seat [17] is assigned to Clark Kent Seat [4] is assigned to The Tick Seat [26] is assigned to Swamp Thing
thx
everyone
is this what you wanted? is this better than
length = strlen(rec->pass_name);
Code:struct fast_line record[] = { /** fill seats wth passengers **/ { "DR Power", 21 }, { "Green Lantern", 2 }, { "The Flash" , 30 }, { "Super Girl" , 7 }, { "Phoenix", 12 }, { "Clark Kent", 17 }, { "The Tick" ,4 }, { "Swamp Thing" , 26 } }; size_t count = (record, sizeof(record) / sizeof * record ); show_seats_taken (record, count ); void show_seats_taken( struct fast_line *rec, size_t size ) { int i, length; //char temp[BUFSIZ]; // length = strlen(rec->pass_name); for( i = 0; i < size; i++ ) printf( "Seat [%i] is assigned to %s \n\n", rec[ i ].seat_number , rec[ i ].pass_name ); }