main.c 487 B

12345678910111213141516171819202122232425
  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 <string.h>
  8. int
  9. main(int argc, char **argv)
  10. {
  11. char *str = malloc(32);
  12. printf("str ptr: %p\n", str);
  13. sprintf(str, "%s", "123456");
  14. printf("str: %s\n", str);
  15. char *str1 = strchr(str, '3');
  16. printf("str1 ptr: %p\n", str1);
  17. printf("str1: %s\n", str1);
  18. free(str);
  19. return 0;
  20. }