char *ch = "abcde";
char c[4];
how to copy 'ch' to 'c'?
Answer Posted / gopi
main()
{
char *ch="abcd";
char c[4];
for(int i=0;i<4;i++)
{
c[i]=*ch;
ch++;
}
printf("%s",c);
getch();
}
Is This Answer Correct ? | 12 Yes | 2 No |
Post New Answer View All Answers
Search for: what is pair in c++?
Why do we use classes in programming?
What is the use of default constructor?
Can union be self referenced?
What are the types of array in c++?
What is a wchar_t in c++?
How many types of classes are there in c++?
What is copy constructor? Can we make copy constructor private in c++?
Can manipulators fall in love?
What are the advantages of c++? Explain
Who invented turbo c++?
What is void pointer in c++ with example?
What are the two types of comments?
Do you know what are static and dynamic type checking?
Is atoi safe?