Explain in detail how strset (string handling function
works )pls explain it with an example.
Answer Posted / 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 |
Post New Answer View All Answers
in iso what are the common technological language?
How can you invoke another program from within a C program?
Write a code to generate divisors of an integer?
What is a pointer variable in c language?
What are loops c?
What are nested functions in c?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
What is far pointer in c?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
Explain heap and queue.
How can you determine the maximum value that a numeric variable can hold?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
what will be maximum number of comparisons when number of elements are given?