Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. struct MyStruct {
  2.  
  3. int member_a;
  4.  
  5. };
  6. int main(){
  7.  
  8. MyStruct s;//method 1
  9.  
  10. MyStruct * ps;//method 2
  11.  
  12. return 0;
  13. }
  14.  
  15. // Example 1
  16. // Referencing a structure member locally in "main()" with the "dot operator"
  17.  
  18. #include <stdio.h>
  19.  
  20. struct Test // unique definition of the struct
  21. {
  22. int x;
  23. };
  24.  
  25. int main(void)
  26. {
  27. struct Test sTest; // we create an instance of the struct
  28.  
  29. sTest.x = 2; // we assign a value to the member of the struct
  30.  
  31. printf("x = %dn",sTest.x);
  32.  
  33. return 0;
  34. }
  35.  
  36. MyStruct s;//method 1
  37.  
  38. MyStruct * ps;//method 2
  39.  
  40. MyStruct s;
  41.  
  42. MyStruct * ps;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement