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

What is void c?

1077


What is preprocessor with example?

1052


Difference between macros and inline functions? Can a function be forced as inline?

1263


What is this infamous null pointer, anyway?

1044


Why is sizeof () an operator and not a function?

1025


5 Write an Algorithm to find the maximum and minimum items in a set of ā€˜n’ element.

2100


Explain is it valid to address one element beyond the end of an array?

1205


Are bit fields portable?

1155


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

1043


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

3055


Is null equal to 0 in sql?

1145


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

1095


What is function prototype in c with example?

1070


Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

1125


What functions are used for dynamic memory allocation in c language?

1141