Results 1 to 4 of 4

Thread: Initialize a binary variable

  1. #1
    Join Date
    Apr 2009
    Posts
    87

    Initialize a binary variable

    I wanted to know is that possible to initialize a variable in binary? In declaration one hex 0x ..., In octal 0 ... In binary? 0b ... does not work. My compiler "GNU GCC compiler, I use Code:: Blocks. For a int a, I would have such increment, but only from the 10th bit (counting from the left). So if a = 34952 (1000100010001000 in binary),it will become 1000100010101000. So I will use the operators>> , I just wanted to initialize a value but in binary.Thank you in advance

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Initialize a binary variable

    You can use XML to set binary arrays.Here is a simple XML array script:

    Code:
    declare @XML xml
    
    set @XML = 
    
    (select * from (select b1= 0,b2 = 0,b3=3, b4=4,b5=0 ) Arrayb for xml auto)
    
    select @XML

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: Initialize a binary variable

    I think you should initialize it first and you must convert it to an int representing the binary value.A default variable is coded in binary, You can do operations on the bit operators (& |>> <<^). For binary variables, there are only two possible values, which can be represented as positive and negative.

  4. #4
    Join Date
    Dec 2008
    Posts
    177

    Re: Initialize a binary variable

    Did you just declare: # define BIT_10 512
    # define BIT_1 1
    # define BIT_2 2
    etc. ...

Similar Threads

  1. What are the Possible attacks of CGI binary in PHP?
    By warehouse peon in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 05:04 AM
  2. What are the different binary directories of Mac
    By Spiero in forum Operating Systems
    Replies: 5
    Last Post: 03-03-2010, 01:26 PM
  3. Binary sockets in C#
    By CheckMeNot in forum Software Development
    Replies: 3
    Last Post: 18-11-2009, 11:02 AM
  4. Replies: 2
    Last Post: 28-08-2009, 07:51 PM
  5. Replies: 3
    Last Post: 25-04-2009, 11:34 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,883,137.94006 seconds with 16 queries