Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MyStruct {
- int member_a;
- };
- int main(){
- MyStruct s;//method 1
- MyStruct * ps;//method 2
- return 0;
- }
- // Example 1
- // Referencing a structure member locally in "main()" with the "dot operator"
- #include <stdio.h>
- struct Test // unique definition of the struct
- {
- int x;
- };
- int main(void)
- {
- struct Test sTest; // we create an instance of the struct
- sTest.x = 2; // we assign a value to the member of the struct
- printf("x = %dn",sTest.x);
- return 0;
- }
- MyStruct s;//method 1
- MyStruct * ps;//method 2
- MyStruct s;
- MyStruct * ps;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement