Qualcomm Interview Question

void foo(char*a, char*b){ while(*a++ = *b**); return; } int main(){ char buf[20]; foo(buff,"Hello"); printf("%s",buff); } what is the output for this program?

Interview Answers

Anonymous

Oct 31, 2013

There are two typos in the question corrected question below void foo(char*a, char*b){ while(*a++ = *b++); return; } int main(){ char buf[20]; foo(buf,"Hello"); printf("%s",buff); } out put: Hello

2

Anonymous

Feb 26, 2010

Are you sure it is while(*a++ = *b**); not while(*a++=*b++)

1