Re: Why does it not work?

Discussion in 'C Programming' started by BartC, Jun 25, 2013.

  1. BartC

    BartC Guest

    "paskali" <> wrote in message
    news:...
    > Hi dear friends, the following:


    > #include <stdio.h>


    > int main(int argc, char *argv[]) {
    >
    > if(argv[1] == "test")
    > puts("OK!");
    > else
    > puts("ERROR");
    >
    > printf("You wrote %s\n", argv[1]);
    >
    > return 0;
    > }


    Try this:

    #include <stdio.h>

    int main (void) {

    int a=1001, b=1001;

    if (&a==&b)
    printf("%d,%d are equal\n",a,b);
    else
    printf("%d,%d are unequal\n",a,b);
    }

    It gives the same funny result, and for the same sort reasons. Comparing
    strings is like sticking those &-operators in.

    --
    Bartc
     
    BartC, Jun 25, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jblazi
    Replies:
    5
    Views:
    451
    jblazi
    Aug 16, 2004
  2. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    484
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    936
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,134
    Smokey Grindel
    Dec 2, 2006
  5. Tarun
    Replies:
    5
    Views:
    412
    Tarun
    Jul 14, 2005
Loading...

Share This Page