main.c 492 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. int
  8. main(int argc, char **argv)
  9. {
  10. char *buf;
  11. printf("Hello world!\n");
  12. buf = malloc(1024);
  13. if (!buf) {
  14. printf("malloc buf failed\n");
  15. return -1;
  16. }
  17. printf("buf ptr: %p\n", buf);
  18. snprintf(buf, 1024, "%s", "1234\n");
  19. printf("buf: %s", buf);
  20. free(buf);
  21. return 0;
  22. }