Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Explain in detail how strset (string handling function
works )pls explain it with an example.



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

Post New Answer

More C Interview Questions

Difference between strcpy() and memcpy() function?

0 Answers  


What is the memory allocated by the following definition ? int (*x)[10];

4 Answers   ADITI, Wipro,


what is the output of the code and how? main() { int *ptr,x; x=sizeof(ptr); printf("%d",x); }

1 Answers  


write aprogram for There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.

1 Answers   iGate, Shashi, Source Bits, Subex,


in linking some of os executables are linking name some of them

0 Answers   IBM,


write a c program in such a way that if we enter the today date the output should be next day's date.

0 Answers  


define function

4 Answers   Assurgent, Sonata,


What are global variables and how do you declare them?

0 Answers  


wap to print "hello world" without using the main function.

22 Answers   TCS, Wipro,


How to calculate Total working time using Login and logout?

2 Answers   CTS, Cygnus, Infosys, Signal Networks, TCS, Wipro,


What is the use of keyword VOLATILE in C?

1 Answers  


what is the difference between <stdio.h> and "stdio.h"

14 Answers   Invendis, Kanbay, Mastek, MathWorks,


Categories