tubeshowcase●1,148,336 videos♡ My collection 0
← Learn to Code

Learn to Code04:12

C structs 🏠

Bro Code ↗

From the creator

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\n", player1.name); printf("%d\n", player1.score); printf("%s\n", player2.name); printf("%d\n", player2.score); return 0; }

Published 2021-10-06 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code