Re: Need some help.

jelson@blaze.cs.jhu.edu
Date: 03/26/94


> Ok,if these are the facts:  	char *arg;
> 	 			arg = "d+3";
> 
> How come the if statment:	if ( (*(arg+1) != '+'))
> 				  { /* whatever */ }
> 
> Always returns true, ie even though the second char in the argument is '+',
> { /* whatever */ ) is still executed?

Can you give us more context?  If the code fragment literally says:

void foo()
{
   char *arg;
   arg = "d+3";
   if ( (*(arg+1) != '+'))
      { /* whatever */ }
}

Then, yes, /* whatever */ shouldn't be executed.  But if you're doing
something more complex, like passing arguments between functions, you
could be making some other error that you're not showing us.

Jeremy



This archive was generated by hypermail 2b30 : 12/07/00 PST