User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:string.h:strspn

strspn

#include <stdlib.h>
size_t strspn(const char *str1, const char *str2);

strspn C Sourcecode Example

/* 
 * strspn example code
 * http://code-reference.com/c/string.h/strspn
 */
#include <stdio.h>
#include <string.h>
 
int main( void )
{
    const char string[] = "the answer is 42";
    int pos = strspn(string, "the answer = 42");
    printf("different char at position :%d\n",pos+1);
    return 0;
}

output of strspn c example

  different char at position :12

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/string.h/strspn.txt · Last modified: 2024/02/16 01:06 (external edit)

Impressum Datenschutz