GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 249 of 258    Print  
What is memset, and why it is used, When it is used?
I need a simple example progam for this with clear definition



  
Total Answers and Comments: 2 Last Update: October 06, 2009     Asked by: psunitha 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 31, 2007 05:53:32   #1  
Bharani        

RE: What is memset, and why it is used, When it is use...

Memset is used to set a buffer with a specific character
for example
memset (dptr 'A' 10); // sets the first 10 character to character 'A'

#include <memory.h>
#include <stdio.h>

int main( void )
{
char buffer[] "This is a test of the memset function";

printf( "Before: sn" buffer );
memset( buffer '*' 4 );
printf( "After: sn" buffer );
}

Output
Before: This is a test of the memset function
After: **** is a test of the memset function


 
Is this answer useful? Yes | No
October 04, 2009 00:04:43   #2  
vignesh1988i Member Since: August 2008   Contribution: 2    

RE: What is memset, and why it is used, When it is used?
How will this memset() function willl handle the worst case (ie) when the string is lesser than the given length
If my string is

char string[] "i love my india";
If I use the function memset(string '*' 20);

Will it handle these type of complexities?

 
Is this answer useful? Yes | No

 Related Questions


I need a simple example progam for this with clear definition 
Latest Answer : How will this memset() function willl handle the worst case (ie) when the string is lesser than the given length If my string is   char string[]="i love my india";If I use the function memset(string, '*' , 20);Will it handle ...
Read Answers (2) | Asked by : psunitha


 Sponsored Links

 
Related Articles

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960&rsquo; s The term object oriented programming&rsquo; was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

The Inheritance Concept In OOPs

The Inheritance Concept In OOPs In object oriented programming objects will be characterised by classes It is possible to learn a lot about an object based on the class it belongs to Even if you are not familiar with the name Maybach If I told you it is a car you would immediately know that it has f
 

Understanding The Message Concept In OOPs

Understanding The Message Concept In OOPs To understand object oriented programming you will need to become familiar with messages As the name implies a message is a process in which software objects will communicate with one another Because of this having one object is not enough mosgoogle An objec
 

Basic concepts of OOPS and Structure of C++ program

Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie
 

Be Prepared for Tech Job Cuts

Even one of the most flourishing and possibly the strongest industries of the future are not experiencing the economic crunch. The tech industry is now experiencing massive job losses in different categories. Although you will still see innovations almost every day from the tech industry through th
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape