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.

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


Please Help Members By Posting Answers For Below Questions

Can the “if” function be used in comparing strings?

981


What is the most efficient way to count the number of bits which are set in an integer?

1001


What is the basic structure of c?

1010


What is c language and why we use it?

1004


What is the difference between fread buffer() and fwrite buffer()?

1106


What is the explanation for modular programming?

1148


How many main () function we can have in a project?

1064


Explain how do you override a defined macro?

1019


How many identifiers are there in c?

962


write a c program to find the sum of five entered numbers using an array named number

2076


What are the advantages of union?

1023


What is the maximum no. of arguments that can be given in a command line in C.?

1087


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

1030


Is it possible to have a function as a parameter in another function?

1038


Explain Basic concepts of C language?

1080