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
Explain two-dimensional array.
Explain what is the advantage of a random access file?
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
How can I use a preprocessorif expression to ?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
Explain do array subscripts always start with zero?
What is advantage of pointer in c?
What is the most efficient way to count the number of bits which are set in an integer?
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
Is file a keyword in c?
about c language
What is difference between static and global variable in c?
What is signed and unsigned?
What is a pointer in c plus plus?