Advertisement
dllbridge

Untitled

Oct 27th, 2024
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1.  
  2. #include   <stdio.h>
  3. #include  <stdlib.h>      
  4. #include  <string.h>
  5.  
  6. char **pp_sz;
  7.  
  8.  
  9. ////////////////////////////////////////////////////////////////////
  10. int main()                                                        //    
  11. {
  12.    
  13.     pp_sz = (char**)malloc(40);
  14.    
  15.  
  16.     char sz [99] = "SONY",
  17.          sz2[99] = "Pictures";
  18.    
  19.     pp_sz[0] = (char*)sz;
  20.     pp_sz[1] = (char*)sz2; 
  21.     pp_sz[2] = (char*)malloc(99);          
  22.  
  23.     strcpy(pp_sz[2], "TDK");
  24.  
  25.     for(int i = 0; i < 3; i++)
  26.     {
  27.        printf("pp_sz[%d] = %s\n", i, pp_sz[i]);  
  28.     }
  29.    
  30.    
  31. return 0;
  32. }
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement