I'm pretty new to Python and I'm having difficulty figuring out how to use the structs. What would the C structs below look like when they are converted into Python?
These are the structs I have:
struct dataT
{
int m;
};
struct stack
{
int top;
struct dataT items[STACKSIZE];
} st;
How would this statement be represented in Python?
st.items[st.top].m
structis just aclasswhere all the members and methods arepublicinstead ofprivateby default. In fact in this regard Python's classes are closer to C'sstructthanclasssince there isn't a notion ofprivatestructis simply a class where all the members and methods are public by default. In C,structs can't have methods because they're not classes since there's no such thing. C also doesn't have a concept of public and private.