Hii!, i’m programming in C/GTK+, but i don’t understood yet why, when I call a function, like gtk_label_set_text (GTK_LABEL (label), "some text"); for example, i don’t need to pass the reference of label pointer to the function. I learned that C pass all arguments as value, than, the function will don’t affect the Widget label, in other scope. Thanks a lot, and sorry my bad english.
Hii!, i’m programming in C/GTK+, but i don’t understood yet why, when I call
Share
You ARE passing a pointer. GTK_LABEL (label) is just a fancy macro that casts/checks the type of ‘label’. But it works with pointers, you’re passing a pointer to gtk_label_set_text.
Also, C passes everything by value. But it’s the pointer you pass as value. The copy of the pointer still points to the same ‘object’, so gtk_label_set_text will manipulate the same object as the caller have.