Intuit Interview Question: Write a function to perform s... | Glassdoor.co.in

Interview Question

Staff Software Engineer Interview Bengaluru

Write a function to perform string copy using pointers

Answer

Interview Answer

1 Answer

0

void main()
{
 char* string1="Hello there";
    char* string2 = (char*)malloc(sizeof(strlen(string1)));
    copyString(string1,string2);
}

void copyString(char* x, char* y)
{
int i=0;
while(x[i]!=0)
{
y[i]=x[i];i++;
}

y[i]=0;

}

Interview Candidate on 04-Jul-2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.