I am using the crypt function like this. Is it correct?

string lol = crypt(plaintext, salt);

Here plaintext and salt are both character arrays(strings). Am I using this function correctly?

When I execute my code it just finishes the program. I checked the code with echo $? and it seems to be 0(which is weird).

I read the crypt manual and don't know what the correct usage is.

2 Answers 2


If those strings have the correct values (salt should be a two-character string, which takes three bytes in memory, two plus one for the null terminator), then this might be right. Totally depends on the code around. That line itself does not determine your programme's return value, that is determined by a return statement in main.


Yes my crypt function is working just like that. There is fault in other part of my code, but my crypt function is working properly. The above usage I posted works for the crypt function.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .