C structs 🏠
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=oKXP1HZ8xIs
C structs tutorial example explained • #C #struct #structs • struct Player • { • char name[12]; • int score; • }; • int main() • { • // struct = collection of related members ( variables ) • // they can be of different data types • // listed under one name in a block of memory • // VERY SIMILAR to classes in other languages (but no methods) • struct Player player1 = { Bro , 4} • struct Player player2 = { Bra , 5} • //strcpy(player1.name, Bro ); • //player1.score = 4; • //strcpy(player2.name, Bra ); • //player2.score = 5; • printf( %s\ • , player1.name); • printf( %d\ • , player1.score); • printf( %s\ • , player2.name); • printf( %d\ • , player2.score); • return 0; • }
#############################
