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
Does c++ have arraylist?
What are keywords in c++?
If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?
Write a note about the virtual member function?
What is static class data?
What is the outcome of cout< a) 16 b) 17 c) 16.5
How do you invoke a base member function from a derived class in which you’ve overridden that function?
What is an overflow error?
Describe private, protected and public – the differences and give examples.
What is the difference between global int and static int declaration?
What is the use of seekg in c++?
Explain what is polymorphism in c++?
What is the last index number in an array of 100 characters a) 100 b) 99 c) 101
What does namespace mean in c++?
What is the difference between method overloading and method overriding in c++?