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
Name four predefined macros.
What will happen if a pointer is deleted twice?
Write syntax to define friend functions in C++.
Does c++ have foreach?
What are the advantages of prototyping?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
Can char be a number c++?
Explain terminate() and unexpected() function?
A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.
How do we implement inheritance in c++?
Can you explicitly call a destructor on a local variable?
You want to link a c++ program to c functions. How would you do it?
What is a literal in c++?
What are the rules for naming an identifier?
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?