#include <stdio.h>
int connect_to_server();
int main(void){
connect_to_server() && printf("Connection successed\n");
return 0;
}
int connect_to_server(){
// do connection staff here
// if connection successed
return 1;
}
Actually, It is very similar to bash script!
3 comments:
I'm finally get ur blog :D
this type of statement depend on compiler optimization , if first statement with operator (&&) doesn't succeed (evaluated to 1 (true) the following statement will ignore ( not evaluated ) otherwise it evaluates (print in this example) .
i think it should work in java (same evaluation principles )
another one
return x > y ? (x>z?1:0):0 ;
u haven't to know all of them , but when u get one of them be sure it have logical flaw cuz c have known rules (besides compilers extensions )
thanks for your comments :)
Post a Comment