Something wrong with this if statement?

This is a discussion on Something wrong with this if statement? within the C Programming forums, part of the General Programming Boards category; I can't get this line to work, it looks like it should work, but... if( (square1=1 && square2=1 && square3=1) ...

  1. #1
    Unregistered
    Guest

    Something wrong with this if statement?

    I can't get this line to work, it looks like it should work, but...

    if( (square1=1 && square2=1 && square3=1) || (square4=1 && square5=1 && square6=1) || (square7=1 && square8=1 && square9=1) )

    I get the error: Lvalue required in function Checkforwin()

    According to some tutorials, Lvalue means a variable, and the square# 's are already variables.

    Some help, please?

    Yes, I know, just another Tic Tac Toe program.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    200
    the equality operator in C is '==' not '=', which is reserved for assignment

  3. #3
    Unregistered
    Guest
    A'ight 'en
    Worked like a charm, thanks.

    Cheers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is wrong with my if statement
    By joker_tony in forum C Programming
    Replies: 6
    Last Post: 05-10-2008, 02:11 AM
  2. what is wrong with my if statement
    By joker_tony in forum C Programming
    Replies: 4
    Last Post: 04-29-2008, 12:26 AM
  3. switch case statement
    By stanlvw in forum C++ Programming
    Replies: 3
    Last Post: 02-26-2008, 04:06 AM
  4. What's wrong with my success statement??
    By cool_dude07 in forum C Programming
    Replies: 7
    Last Post: 07-21-2007, 11:22 PM
  5. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 11:01 AM

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