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

What sorting algorithm does c++ use?

1159


Explain selection sorting?

1093


Which software is best for coding?

1051


What is a static element?

1084


Explain virtual class?

1041


What is c++ vb?

1109


What are advantages of c++?

1028


In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....

2425


What is searching? Explain linear and binary search.

999


What is scope resolution operator in c++ with example?

1044


What is difference between c++ 11 and c++ 14?

1103


In the derived class, which data member of the base class are visible?

1118


Differentiate between late binding and early binding.

1283


Why cstdlib is used in c++?

1049


What are the operators in c++?

1120