Re: Significance of using + before function calls.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That must be a typographical error.

Because '+' does nothing to the return value of the function.
Also because there is no lvalue in the expression.

But with '-', there is an effect.


int dummy_func() { return 5; }

int num = -dummy_func();


As a result, num will be '-5'.

Vamsi wrote:

Joel M. Pareja wrote:

The placement of '+' or '-' before the function call is performing a
unary operator on the return value of the function.

does it server any purpose ? , unary '+' operator will not have any significance effect on the return value

-Vamsi


Vamsi wrote:

Hi List,

i have seen a code snippet which starts with + symbol,

+system("ls -l");

what is the significance of using + symbol before system.

i also tried using + before printf ,, like +printf("Some text"); and it is compiling and working tooo,,

Can somebody clarify wht does that + signify??

Thank You.

-Vamsi

-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux