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...

char *ch = "abcde";
char c[4];
how to copy 'ch' to 'c'?

Answer Posted / wade stone

#include <stdio.h>
#include <string.h>

using namespace std;

int main( )
{
char *ch = "abcde";
char c[4];

memcpy( c, ch, sizeof( c ) );

return 0;
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why would you use pointers in c++?

1215


What is atoi?

1022


What is the role of static keyword for a class member variable?

1114


How can a called function determine the number of arguments that have been passed to it?

1192


What is pure virtual function? Or what is abstract class?

1118


what are Operators and explain with an example?

1222


When does a 'this' pointer get created?

1149


What is an orthogonal base class in c++?

1210


Where must the declaration of a friend function appear?

1016


What is #include cmath?

1143


How to give an alternate name to a namespace?

1127


How many different levels of pointers are there?

1277


What is the cout in c++?

1104


Explain virtual class?

1079


Why is c++ not purely object oriented?

1059