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
Explain deep copy and a shallow copy?
Explain binary search.
What are c++ redistributables?
Explain the concept of dynamic allocation of memory?
What is the difference between a reference and a pointer?
Why is "using namespace std;" considered bad practice?
What is near, far and huge pointers? How many bytes are occupied by them?
What is pointer to array in c++?
What are the uses of typedef in a program?
What are the c++ access specifiers?
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.
What is namespace std; and what is consists of?
Will this c++ program execute or not?
What is the difference between strcpy() and strncpy()?
What is the full form of india?