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

in iso what are the common technological language?

2158


How can you invoke another program from within a C program?

1116


Write a code to generate divisors of an integer?

1103


What is a pointer variable in c language?

1149


What are loops c?

1094


What are nested functions in c?

1070


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2362


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

1062


What is far pointer in c?

1384


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

1186


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

2280


Explain heap and queue.

1138


How can you determine the maximum value that a numeric variable can hold?

1292


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

1535


what will be maximum number of comparisons when number of elements are given?

1950