i need help to initialize this pointer :

This is a discussion on i need help to initialize this pointer : within the C++ Programming forums, part of the General Programming Boards category; i have the following code : Code: void viewall () { agendaview *person; person = person; cout <<person->name<<' '; cout ...

  1. #1
    n00b-for-rent
    Guest

    Arrow i need help to initialize this pointer :

    i have the following code :

    Code:
    void viewall ()
    {
    	agendaview *person;
    	person = person;
    	cout <<person->name<<' ';
    	cout <<person->tel<< ' ';
    	cout <<person->adress<<endl;
    }
    thx in advance

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Code:
    void viewall ()
    {
            agendaview *person;
            person = person;
            cout <<person->name<<' ';
            cout <<person->tel<< ' ';
            cout <<person->adress<<endl;
    }
    I don't understand what you want to do. If you want to use a pointer to something, you need to either assign it to a different valid pointer, or dynamically allocate memory.

    agendaview *person = new agendaview(constructor_arg_1, constructor_arg_2);

    // output stuff

    delete person;
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  2. What is a virtual function pointer?
    By ting in forum C++ Programming
    Replies: 4
    Last Post: 03-05-2008, 01:36 AM
  3. How did you master pointers?
    By Afrinux in forum C Programming
    Replies: 15
    Last Post: 01-17-2006, 07:23 PM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21