Emptying Values

This is a discussion on Emptying Values within the C++ Programming forums, part of the General Programming Boards category; how do you make an integer worth nothing? Would you use empty[x]? I haven't tried that yet. And I am ...

  1. #1
    Registered User GreenCherry's Avatar
    Join Date
    Mar 2002

    Emptying Values

    how do you make an integer worth nothing? Would you use empty[x]? I haven't tried that yet. And I am assuming you empty an apstring by doing:
    x = "";
    Quick answers would be appreciated.

  2. #2
    I lurk
    Join Date
    Aug 2002
    Make it equal to 0?

    int i = 200;

    // ...

    i = 0;

  3. #3
    S Sang-drax's Avatar
    Join Date
    May 2002
    GŲteborg, Sweden
    This empties the interger t, with error checking to make sure it really is emptied.
    Only works on x86 compatible processors though.
        int t;
         mov cx, 0x003f
           mov t,0
           cmp t,0
           je exception
         loop cpuflag
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    As long as a variable "exists" and as long as it is in scope, it has to have some value. It can contain zero, but I wouldn't call a numerical variable "empty". Variables "point to" physical memory (probably a bad choice of words because we're not talking about pointers.) That physical memory has some binary number in it... maybe zero!

    C++ finds the end of a string by looking for the first NULL (zero). So a string that starts with NULL (often expressed as '\0') will be treated as "empty" and will have a length of zero.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. putting values into an array
    By zdream8 in forum C Programming
    Replies: 15
    Last Post: 05-21-2008, 11:18 PM
  2. Replies: 1
    Last Post: 12-30-2007, 09:08 AM
  3. Need help with project
    By chrisa777 in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2006, 05:01 PM
  4. Replies: 1
    Last Post: 02-03-2005, 02:33 AM
  5. adding ASCII values
    By watshamacalit in forum C Programming
    Replies: 1
    Last Post: 12-26-2002, 06:16 PM

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