Explain in detail how strset (string handling function
works )pls explain it with an example.
Answer / lakshman
strnset - strset - Set Bytes in String
Syntax
#include <string.h>
char *strnset(char *string, int c, size_t n);
char *strset(char *string, int c);
Example:
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str = "abcdefghi";
printf("This is the string: %s\n", str);
printf("This is the string after strnset: %s\n",
strnset(str, 'x', 4));
printf("This is the string after strset: %s\n",
strset(str, 'k'));
return 0;
/****************************************************************************
The output should be:
This is the string: abcdefghi
This is the string after strnset: xxxxefghi
This is the string after strset: kkkkkkkkk
****************************************************************************/
}
Is This Answer Correct ? | 11 Yes | 12 No |
For what purpose null pointer used?
different between overloading and overriding
how to print "hai" in c?
Are there constructors in c?
code for quick sort?
What is encapsulation?
Why is structure padding done in c?
Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?
What is wrong with this program statement? void = 10;
Tell me what is the purpose of 'register' keyword in c language?
Explain why c is faster than c++?
what is the return type of printf