IT. Expert System.

C

memset()


It is used to initialize a specified number of bytes to null or any other value in the buffer

Syntax:
void * memset(void *dest, int c, size_t count);


Example:

memset( ) function is used to initialize specified number of bytes to null or to any other value in the buffer.
#include 
#include 
#include 

int main()
{
   int i;
   /* allocate memory for array of 5 elements */
   char *a = (char *) malloc(5*sizeof(char));
   printf("Values before memset\n");
   for (i = 0; i < 5; ++i)
       printf("  a[%d] = %d ,", i,    a[i]);

   /* all elements are set to 3. it can be set to any value */
   memset(a, 3, 5*sizeof(char));
      printf("\nvalues after memset\n");
   for (i = 0; i < 5; ++i)
       printf("  a[%d] = %d ,", i,    a[i]);
   // remove x from memory
   free(a);
   return 0;
}
 output:

values before memset
a[0] = 0 , a[1] = 0 , a[2] = 0 , a[3] = 0 , a[4] = 0
values after memset
a[0] = 3 , a[1] = 3 , a[2] = 3 , a[3] = 3 , a[4] = 3


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: 1527 / . Delta: 0.01828 с