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

What are manipulators used for?

1040


Describe about storage allocation and scope of global, extern, static, local and register variables?

1205


Can class objects be passed as function arguments?

1014


What is pair in c++?

1006


What's the "software peter principleā€?

1093


How would you implement a substr() function that extracts a sub string from a given string?

996


What is low level language in simple words?

978


What are namespaces in c++?

1035


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

1270


What is static class data?

992


Explain the virtual inheritance in c++.

1007


What are the syntactic rules to be avoid ambiguity in multiple inheritance?

1125


Why do you use the namespace feature?

1045


Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?

1019


What is a hash function c++?

1025