Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.20 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <malloc.h>
  3.  
  4. void foo(int** p){
  5.   *p = malloc(sizeof(int) * 1);
  6.   (*p)[0] = 1;
  7. }
  8.  
  9. int main(){
  10.   int* p = NULL;
  11.   foo(&p);
  12.   printf("%d", *p);
  13.   free(p);
  14.   return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement