Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <string.h>
  2. #include <glib.h>
  3. #include <glib/gprintf.h>
  4.  
  5. void foo (const gchar *str) {
  6.     str = "Tu es beau";
  7. }
  8.  
  9. void foo_gtk (const gchar *str) {
  10.     gchar *str2 = g_strndup (str, strlen(str));
  11.     g_stpcpy (str2, "Tu es bof");
  12.     g_free (str2);
  13. }
  14.  
  15. int main (int argc, char **argv) {
  16.     const gchar *str = "Tu es moche";
  17.     foo (str);
  18.     g_printf ("%s\n", str);
  19.     foo_gtk (str); 
  20.     g_printf ("%s\n", str);
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement