Thread: Passing Structure by Reference

  1. #16
    Registered User
    Join Date
    Mar 2012
    Ok. This is what I did to solve the problem.


    LOGIN_GetUsername(STRUCT_Users, STRUCT_Login, COUNT_Struct_Users);


    LOGIN_GetUsername(STRUCT_Users, &STRUCT_Login, COUNT_Struct_Users); // Added an ampersand.
    Which is correct, right? Just wanted to double-check since I might encounter another hidden error.

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Well, yes, that is correct, but of course fixing one bug does not necessarily mean that there are no bugs left. Pay attention to your compiler's warnings.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing structure by reference or pointer?
    By 7force in forum C Programming
    Replies: 8
    Last Post: 12-13-2010, 06:49 PM
  2. Passing structure by reference through 4 functions
    By nickdavid35 in forum C Programming
    Replies: 14
    Last Post: 04-30-2010, 09:39 AM
  3. Problem Passing Structure Reference To Function
    By soj0mq3 in forum C Programming
    Replies: 9
    Last Post: 04-24-2010, 10:27 AM
  4. Reference to a Structure
    By boschow in forum C Programming
    Replies: 3
    Last Post: 03-28-2008, 02:37 PM
  5. passing by address vs passing by reference
    By lambs4 in forum C++ Programming
    Replies: 16
    Last Post: 01-09-2003, 01:25 AM

Tags for this Thread