passing by value

main( ) {

int c = 5 ; c = slogan( ) ; printf ( “\n%d”, c ) ; } void slogan( ) { printf ( “\nOnly He men use C!” ) ; }
… when c gets print it gives some absurd value…but it should be 5…HELP ME OUT!!!

It’s because you are assigning c=slogan() which is of void type.As slogan is not returning any thing,value in c will be assigned to a garbage value.Try changing c=slogan(); to slogan(); it will work.

thanks…