STRINS(3pub)

πŸ’– STRINS(3pub) πŸ’–

okay bestie, welcome to the publib corner of the C Programmer's Manual ✨ this one lives in section 3pub and it's genuinely so simple you're gonna be obsessed 🫢


✨ NAME ✨

strins β€” insert a string at the beginning of another string 🌸

like. that's it. that's the whole job. no cap. πŸ’…


✨ SYNOPSIS ✨

#include <publib.h>
char *strins(char *tgt, const char *src);

✨ DESCRIPTION ✨

so here's the tea β˜• strins inserts the src string at the beginning of the tgt string. front of the line. first in the queue. main character position. πŸ‘‘

⚠️ but bestie, listen: the strings must not overlap. do not do that. fr fr.
⚠️ also, the target string must contain enough memory to hold both strings. you gotta have the room already. strins is not out here doing your memory math for you, she's just inserting. πŸŽ€

✨ RETURN VALUE ✨

strins returns its first argument. that's it. she hands you back the tgt pointer you gave her. iconic behaviour, honestly. πŸ’œ


✨ EXAMPLE ✨

not me giving you homework β€” but the example lives over in the manual page for strdel(3). go peek there. πŸ¦‹


✨ SEE ALSO ✨


✨ AUTHOR ✨

Lars Wirzenius (lars.wirzenius@helsinki.fi) 🌟 thank you king


Publib πŸ’– C Programmer's Manual πŸ’– and yeah, that's the STRINS(3pub) page, bestie β€” go forth and insert your little strings at the front, and remember: no overlap, and enough memory or it's giving πŸ’€ πŸŽ€

πŸ“¦ where this page comes from