Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Re: Why does it not work? (http://www.velocityreviews.com/forums/t962142-re-why-does-it-not-work.html)

BartC 06-25-2013 08:46 PM

Re: Why does it not work?
 


"paskali" <2970invalid@webuse.net> wrote in message
news:201306251944442970@webuse.net...
> 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



All times are GMT. The time now is 05:20 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.