Xor

This is a discussion on Xor within the C Programming forums, part of the General Programming Boards category; Consider the following code: arraysum[coll][line] = arraysum[coll][line] ^ array[coll][line]; Every variables are typed int and the arrays can only take ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    5

    Xor

    Consider the following code:

    arraysum[coll][line] = arraysum[coll][line] ^ array[coll][line];

    Every variables are typed int and the arrays can only take 1 and 0 as values.

    My compiler reports an error:
    "operands of ^ have illegal types 'int' and 'pointer to int'"

    By the way, I use lcc-win32.

    Where is the error, the code or the compiler?
    Last edited by Danny_Beaudoin; 07-30-2004 at 06:24 PM.

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    What are the exact definitions of arraysum and array?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    aslo you know that can be shorthanded
    Code:
    arraysum[coll][line] = arraysum[coll][line] ^ array[coll][line];
    
    arraysum[coll][line]^=array[coll][line];
    of course once we help you figure out the error.

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    5
    int array[21][4][4];
    int arraysum[4][4];

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    arraysum[coll][line] = arraysum[coll][line] ^ array[coll][line];
    Code:
    int array[21][4][4];
    int arraysum[4][4];
    You mean to say it isn't obvious what the problem is here?

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    5
    lol!
    Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple of questions about XOR linked lists...
    By klawson88 in forum C Programming
    Replies: 5
    Last Post: 04-19-2009, 05:55 PM
  2. Simple Xor Encryption help
    By soadlink in forum Windows Programming
    Replies: 13
    Last Post: 10-18-2006, 12:51 PM
  3. what the XOR!!
    By the bassinvader in forum C Programming
    Replies: 10
    Last Post: 08-11-2006, 03:08 PM
  4. Function program not working...
    By sirSolarius in forum C++ Programming
    Replies: 7
    Last Post: 09-26-2003, 08:35 PM
  5. XOR lists?
    By bgrahambo in forum C++ Programming
    Replies: 4
    Last Post: 02-26-2002, 10:02 PM

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