fork(1) download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. //Textarrays (wie z.B argv von main)
  5. char *deutsch[] = { "Hallo", "Welt", "!", NULL};
  6. char *english[] = { "Hello", "World!", NULL};
  7.  
  8. void textout(char **ppc) // Doppelzeiger
  9. { while (*ppc != NULL)
  10. { printf("1.Zeichen: %c. Text: %s\n", *ppc[0], *ppc);
  11. ++ppc;
  12. }
  13. }
  14.  
  15. void settext(char ***pppc, int i)
  16. // einen Doppelzeiger aus einer Funktion heraus ändern
  17. // das würde man anders lösen, ist ja nur ein Beispiel
  18. {
  19. if (i == 0)
  20. *pppc = deutsch;
  21. if (i == 1)
  22. *pppc = english;
  23. }
  24.  
  25.  
  26. int main (int argc, char ** argv)
  27. {
  28. char **ppc;
  29.  
  30. ppc = deutsch;
  31. textout(ppc);
  32.  
  33. settext(&ppc,1);
  34. textout(ppc);
  35.  
  36. return 0;
  37. }
  38.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
1.Zeichen: H. Text: Hallo
1.Zeichen: W. Text: Welt
1.Zeichen: !. Text: !
1.Zeichen: H. Text: Hello
1.Zeichen: W. Text: World!