main.c 885 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #include <stdbool.h>
  8. #include <malloc.h>
  9. #include <string.h>
  10. #include <inttypes.h>
  11. #include <math.h>
  12. int
  13. main(int argc, char **argv)
  14. {
  15. printf("Hello World!\n");
  16. char *buf = "1234", *buf1 = "12345";
  17. printf("result is %f \n", 22.00);
  18. printf("Hello World!\n");
  19. buf = malloc(1024);
  20. printf("malloc func ptr: %p\n", malloc);
  21. printf("##buf: %p\n", buf);
  22. if (!buf) {
  23. printf("malloc buf failed\n");
  24. return -1;
  25. }
  26. printf("buf ptr: %p\n", buf);
  27. sprintf(buf, "%s", "1234\n");
  28. printf("buf: %s", buf);
  29. buf1 = strdup(buf);
  30. printf("buf1: %s\n", buf1);
  31. free(buf1);
  32. free(buf);
  33. printf("buf[65536]: %c\n", buf[65536 * 10]);
  34. return 0;
  35. }