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 |
Explain the concept of "dangling pointers" in C.
ATM machine and railway reservation class/object diagram
What is encapsulation?
int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give me the explanation.
write a program in C to swap two variables
int main() { int i=1; switch(i) { case '1': printf("hello"); break; case 1: printf("Hi"); break; case 49: printf("Good Morning"); break; } return 0; }
what is c programming?
Identify the correct argument for the function call fflush () in ANSI C: A)stdout B)stdin C)stderr D)All the above
How we add our function in liabrary as liabrary function. Exp. we want use our int factorical(int); function as int pow(int,int); function working in math header file.
dynamically allocate memory for linear array of n integers,store some elements in it and find some of them
What is the general form of function in c?
what is the hardware model of CFG( context free grammar)