Thread: Question related to NULL assignment in pointers to structs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by C_me_run
    It's initialization and assignment, unless "=" is not an assignment operator (and yes it is)
    No, in this context "=" is not the assignment operator. While initialisation certainly involves assignment in the computer science sense, C distinguishes between initialisation and assignment, that's why I noted that "that's initialisation, not assignment". I did not mean to imply that there was no assignment of value, because of course initialisation involves the initial assignment of a value.

    Quote Originally Posted by C_me_run
    No, actually this is not true at all. Let me prove it:
    Good to see that rstanley cleared it up, though you must have missed my preceding sentence about static storage duration because "you have declared these variables outside of a function" and how that means that those variables are "are initialised at startup".

    Quote Originally Posted by rstanley
    Explicitly initializing ALL variables is always a god idea, especially pointers!
    Ascribing divinity might be taking it a step too far, but I suppose it works!
    Last edited by laserlight; 12-11-2023 at 12:23 AM.
    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. Another pointers / struct/ array related question
    By patishi in forum C Programming
    Replies: 3
    Last Post: 09-11-2013, 05:25 PM
  2. a question on pointers, structs and arrays
    By onefootswill in forum C Programming
    Replies: 3
    Last Post: 12-06-2007, 01:27 AM
  3. A question on Pointers & Structs
    By FJ8II in forum C++ Programming
    Replies: 4
    Last Post: 05-28-2007, 10:56 PM
  4. Question related to array and pointers
    By Q4u in forum C++ Programming
    Replies: 6
    Last Post: 07-26-2002, 12:54 PM
  5. Pointers Question.....Null Pointers!!!!
    By incognito in forum C++ Programming
    Replies: 5
    Last Post: 12-28-2001, 11:13 PM

Tags for this Thread