Thread: problem with if...can you help?

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    1

    problem with if...can you help?

    xxxx
    Last edited by blinded; 04-09-2010 at 04:18 PM. Reason: delete

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Step 1: Put your code inside code tags. You can either highlight your code and click the # sign in the edit window, or you can type [code] at the beginning of the code and [/code] at the end.

    Step 2. Why do you think "it" (whatever or whoever "it" is) has a problem (whatever the problem is, which is unspecified) with the if comparison (whichever of the if comparisons you have in your code)?

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by blinded View Post
    it seems it have a problem with the if comparison...Can anyone tells me why??
    #1 Use code tags when posting code. You may have noticed this at the top of the board:
    << !! Posting Code? Read this First !! >>
    That does not mean "Posting Code? Ignore this!"

    #2 Indent.

    #3 Describe the problem.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > int n;
    > int s[n];
    What garbage value of n is being used to specify the sizes of these arrays?
    There's a 50% chance it's NEGATIVE!

    > for (int i=1; i<=n; i++)
    Arrays begin at 0, not 1

    Oh, and having variables called p and P (differing only by case) will confuse you. Try picking some meaningful names.

    For C programming, try using these options (for gcc)
    Code:
    gcc -W -Wall -ansi -pedantic -O2 prog.c
    It would throw out a lot of the dubious code you have.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM