Re: [Vala] Is this the right syntax for defining pointers in Vala ?



On Mon, Jun 20, 2011 at 08:38:29PM +0200, Serge Hulne wrote:
Is this the right syntax for defining pointers in Vala ?

//------
using Posix;

void main (string[] argv) {
    string a = "hello";
    var b = &a;
    strcpy(*b, "bye");
    Posix.stdout.printf("a = %s\n", a);
    Posix.stdout.printf("b = %s\n", *b);
}
//-----

If not, how does one declare that a and b point to the same object in Vala ?

Maybe you're looking for unowned string b = a;

Pointers are with * anyway.

-- 
http://www.debian.org - The Universal Operating System



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]