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 |
Fifty minutes ago if it was four times as many mints past 3 o clock. how many minutes is it to six o'clock n how....?????
how 2 compile & execute c program with out using editor?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
what's the return value of malloc()
What is a C array and illustrate the how is it different from a list.
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
write a program which counts a product of array elements lower than 10.
If the size of int data type is two bytes, what is the range of signed int data type?
Difference between strcpy() and memcpy() function?
Can you think of a way when a program crashed before reaching main? If yes how?
How can a program be made to print the name of a source file where an error occurs?
What is typedf?