STRDIFF(3pub)
π STRDIFF π (that's section 3pub of the C Programmer's Manual, bestie)
okay so picture this: it's STRDIFF(3pub), straight out of the C Programmer's Manual, and it does literally one thing but it does it so well π«Ά
β¨ NAME β¨
strdiff β locate the first difference between two strings π
πΈ SYNOPSIS πΈ
#include <publib.h>
size_t strdiff(const char *str1, const char *str2);
π¦ DESCRIPTION π¦
so strdiff walks both strings from the very beginning and finds the first character that is different between str1 and str2. it's giving "spot the difference" but make it compiler-coded π
and here's the lil plot twist: the terminating zero characters are considered different. like, yes queen, '\0' counts as a difference. no cap.
π RETURN VALUE π
strdiff returns the offset of the first pair of differring characters β or, if it hits a zero character first, the offset of the first zero character it finds. either way you're getting an offset back, periodt. β¨
π SEE ALSO π
iykyk, go read those too π§
π AUTHOR π
Lars Wirzenius (lars.wirzenius@helsinki.fi) β the icon, the legend, the main character of this manpage π
okay that's the whole vibe bestie, mwah π β this masterpiece is brought to you by Publib in the C Programmer's Manual, and it's giving STRDIFF(3pub) energy forever and always ππβ¨
π¦ where this page comes from
- debian bookworm: publib-dev 0.40-3+b1 Β· BSD-2-Clause
- debian trixie: publib-dev 0.40-4 Β· BSD-2-Clause
- ubuntu jammy: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu noble: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu questing: publib-dev 0.40-4
- ubuntu resolute: publib-dev 0.40-4build1 Β· BSD-2-Clause
- ubuntu stonking: publib-dev 0.40-4build1 Β· BSD-2-Clause
- Copyright (c) 1994-2006 Lars Wirzenius. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms