fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. #define N 10
  6.  
  7. int main(void) {
  8.  
  9. char **ppchar = malloc(sizeof(char *) * N);
  10.  
  11. *ppchar = malloc(100); // now it is a char *pointer and I allocate the memory for the chars
  12.  
  13. strcpy (*ppchar, "Hello world");
  14.  
  15. printf("the char string = %s\n", *ppchar);
  16. printf("and the actual chars. First = %c and fourth = %c\n", *(*ppchar + 0), *(*ppchar + 3));
  17. }
  18.  
Success #stdin #stdout 0s 4516KB
stdin
Standard input is empty
stdout
the char string = Hello world
and the actual chars. First = H and fourth = l