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 |
how to make program without <> in library.
In how much time you will write this c program? Prime nos from 1 to 1000
write a function which accept two numbers from main() and interchange them using pointers?
What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..
Do character constants represent numerical values?
How to add two numbers with using function?
find out largest elemant of diagonalmatrix
What are categories used for in c?
Is both getch() and getchar() functions are similar? if it is similar means why these two functions are used for same usage? if it is not similar means what is the difference?
What does %p mean?
Can a file other than a .h file be included with #include?
Where define directive used?