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
Is python better than c++?
Which is better c++ or java?
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.
Is it possible to write a c++ template to check for a function's existence?
What is public, protected, private in c++?
Is c++ high level programming language?
Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?
What do you mean by friend class & friend function in c++?
What are manipulators used for?
If there are two catch statements, one for base and one for derived, which should come first?
What do you mean by a template?
Explain 'this' pointer and what would happen if a pointer is deleted twice?
How many standards of c++ are there?
What is data abstraction? How is it different from data encapsulation?
What is do..while loops structure?