Hi i know this may sound a bit silly but i have looked through some websites but can't really find exactly what the difference is between "=" and "=="

For example

if(x==0) execl(“/bin/ps”, “ps”,”-eal”,NULL)

how is that different from

if(x=0) execl(“/bin/ps”, “ps”,”-eal”,NULL)

thanks

Recommended Answers

All 2 Replies

'=' is an assignment operator
'==' is a comparison operator

do you want to assign a value
or compare two values

'=' is an assignment operator
'==' is a comparison operator

do you want to assign a value
or compare two values

ah thank you i totally understand now. Don't know why i didnt before

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.