+ 6
difference between sprintf and strcpy ?
when i used strcpy and sprintf to assign a value to an array in my struct i got the same output i coudn't notice any difference, does one of them have a hidden feature ? this is the code ⬇️ https://code.sololearn.com/cZVCpjSertLc/?ref=app
4 ответов
+ 3
sprintf is printf for string. Everything you can do with printf can be achieved with sprintf.
example: sprintf(name, "%s %s", first_name, last_name);
strcpy just copies string to the other.
+ 1
Thanks Martin .. it helped :)
0
I don't know anything about the differences, except that fact that sprintf allows string formatting.
0
Thanks carrie