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 / parth ujenia

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

for(int i=0;i<4;i++)
{
c[i]=*ch; //assign value to char c[i].
*ch++; //switch to next address of ch!
}

for(i=0; i<4 ;i++)
{
printf("%c - ",c[i]); //output will: a - b - c - d -
}

getch();

}

Is This Answer Correct ?    18 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many namespaces are there in c++?

1009


What is a character in c++?

995


What is c++ flowchart?

1319


How long it will take to learn c++?

995


What is an accessor in c++?

1020


Differentiate between a constructor and a destructor in c++.

968


Difference between a homogeneous and a heterogeneous container

1090


what is the difference between overloading & overriding? give example.

1100


Do you know what are pure virtual functions?

1105


How do you master coding?

987


When must you use a pointer rather than a reference?

987


What is the main use of c++?

1061


What sorting algorithm does c++ use?

1079


Do vectors start at 0?

943


How can I improve my c++ skills?

1067