Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1.  
  2. struct base_type_test{
  3. int a;
  4. int b;
  5. char arr[10];
  6. };
  7.  
  8. struct nested_struct_1{
  9. int a;
  10. struct base_type_test nested_base;
  11. };
  12.  
  13. struct nested_struct_2{
  14. struct nested_struct_1 first;
  15. int normal_int;
  16. };
  17.  
  18. // should return as size 4
  19. struct nested_struct_2 var_double_nested_struct;
  20.  
  21. struct nested_struct_2 get_tim(){
  22. struct nested_struct_2 tim;
  23. tim.first.nested_base.arr[2] = '@';
  24. return tim;
  25. }
  26.  
  27. int main(){
  28. struct nested_struct_2 dave;
  29. //dave.first.nested_base.arr[2] = '#';
  30.  
  31. print_c(get_tim().first.nested_base.arr[2]);
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement