Tuesday, 27 August 2013

memchr c function

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main()
{
    char *str;

    if((str=memchr("this is a test", 'is'  ,79  ))==NULL)
    {
        puts("specified charecter dosen't exit");
        getchar();
        exit(1);
    }

    puts(str);

    getchar();
    return 0;
}

//returns the first occurance of the specified charecter with in the specified lenght

No comments:

Post a Comment