Learn to Code via Tutorials on Repl.it!

← Back to all posts
C structs
Jakman

A struct is a data structure creator that allows for basic Object oriented programming in C. Structs are made out side of the main function much like multiple classes in the same java/C# file. here is how it is done.

The struct made is called mystruct and therefore is what it will be refrenced as from there on. I gave it some variables to be called later and closed the struct. The struct shows up in the main function. you have to call made structs in main by using the keyword struct followed by the name of the previously made struct and that is followed by whatever name you want to refrence that struct by. Then we give pass previously created variables to whatever the user wants. I personally made it to fit me. Then the individual values are printed out to the console and the program ends.
As always ask me questions if you need to. bye

Voters
YashvardhanJ1035
JulianoEletroni
ludovicana
davehazz
dldkgus9009
Jakman