How memset Function of C Works

void memset(void *first_byte_address, int value, int size)
{
    int i;
    char *cp = (char *)first_byte_address;

    for(i = 0; i < size; i++)
    {
        *cp = value;
        cp++;
    }
}

// this is not the exact memset function of C, it is just a guess of this blog author

Comments

Popular posts from this blog

Timus 1209. 1, 10, 100, 1000... accepted solution in C

Timus Problem 1086. Cryptography Accepted Solution in C

Timus 1083. Factorials!!! Accepted Solution in C