IT. Expert System.

C

memchr()


The C library function void *memchr(const void *str, int c, size_t n) searches for the first occurrence of the character c (an unsigned char) in the first n bytes of the string pointed to by the argument str.

Syntax:
void *memchr(const void *str, int c, size_t n)

str -- This is the pointer to the block of memory where the search is performed.

c -- This is the value to be passed as an int, but the function performs a byte per byte search using the unsigned char conversion of this value.

n -- This is the number of bytes to be analyzed.


Example:

memchr( ) function is used to locate the first occurrence of the character in the specified string.
#include 
#include 

int main ()
{
  char *ptr;
  char string[] = "technicia"
  ptr = (char *) memchr (string, 'h', strlen(string));
  if (ptr != NULL)
    printf ("character 'h' is found at " \
            "position %d.\n", ptr-string+1);
  else
    printf ("character 'h' is not found.\n");
  return 0;
}
Output:

character ‘h’ is found at position 4


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1591 / . Delta: 0.01624 с