You are not logged in.
Pages: 1
Is there a quick way to compare a character string with a constant such as "hello" in c?
I'd really like to do this without having to write a function ( i know it wouldn't be hard but...)
Offline
searching google turned up alot of hits...
http://www.gnu.org/software/libc/manual … rison.html
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
Is there a quick way to compare a character string with a constant such as "hello" in c?
I'd really like to do this without having to write a function ( i know it wouldn't be hard but...)
void foobles(constr char* str)
{
if(strcmp(str,"hello whirled") == 0)
puts("strings are the same");
}
Offline
Euphoric Nightmare wrote:Is there a quick way to compare a character string with a constant such as "hello" in c?
I'd really like to do this without having to write a function ( i know it wouldn't be hard but...)
void foobles(constr char* str) { if(strcmp(str,"hello whirled") == 0) puts("strings are the same"); }
That is awesome...I didn't know about strcmp
Offline
Pages: 1