test.c 646 B

1234567891011121314151617181920212223242526272829303132
  1. /* simple test compilation */
  2. #include <stdio.h>
  3. struct hello_struct {
  4. char *buffer_field;
  5. };
  6. typedef struct hello_struct hello_typedef;
  7. static void echo1(struct hello_struct hello_struct_echo1)
  8. {
  9. char *echo1_nouse = NULL;
  10. printf("%s\n", hello_struct_echo1.buffer_field);
  11. }
  12. static char echo2(struct hello_struct *hello_struct_echo2)
  13. {
  14. return (char)printf("%s\n", hello_struct_echo2->buffer_field);
  15. }
  16. int main(void)
  17. {
  18. static char buffer [] = "hello, world\n";
  19. struct hello_struct hello_struct_obj = { .buffer_field = buffer, };
  20. printf("%s\n", buffer);
  21. echo1(hello_struct_obj);
  22. echo2(&hello_struct_obj);
  23. return 0;
  24. }