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
What are manipulators used for?
Describe about storage allocation and scope of global, extern, static, local and register variables?
Can class objects be passed as function arguments?
What is pair in c++?
What's the "software peter principleā?
How would you implement a substr() function that extracts a sub string from a given string?
What is low level language in simple words?
What are namespaces in c++?
Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.
What is static class data?
Explain the virtual inheritance in c++.
What are the syntactic rules to be avoid ambiguity in multiple inheritance?
Why do you use the namespace feature?
Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?
What is a hash function c++?