Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

=+ operator in c++?

Tags:

c++

operators

I have a question on a program that includes the following if statement:

if (x =+ 4){
    x += 5;
}

I've never seen anything like that before, surely it isn't a typo? Does =+ actually do anything?

like image 670
Hoyeh Avatar asked Sep 30 '16 17:09

Hoyeh


1 Answers

x =+ 4

means

x= (+4)

or simply

x=4

though such construction syntactically correct and can be compiled, does not make much sense and most probably a typo, where x==4 was intended, especially that it is used as condition for if

like image 115
Slava Avatar answered Nov 01 '22 11:11

Slava