Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void str_cpy(char *,char *);
void main()
{
char a[20],b[20];
printf("enter the string to be copied:");
gets(b);
str_cpy(a,b);
puts(a);
getch();
}
void str_cpy(char *str,char *str1)
{
if(str1!='\0')
{
*str=*str1;
str_cpy(++str,++str1);
}
str='\0';
}
thank u
| Is This Answer Correct ? | 8 Yes | 8 No |
Post New Answer View All Answers
What is the difference between struct and typedef struct in c?
What does the file stdio.h contain?
What is the size of a union variable?
Tell me when is a void pointer used?
What is function prototype?
Explain what is the difference between a string and an array?
Explain what are linked list?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Are bit fields portable?
What does the format %10.2 mean when included in a printf statement?
Can a pointer be null?
Is c weakly typed?
Explain what is the best way to comment out a section of code that contains comments?
What is sizeof c?
What does a pointer variable always consist of?