Apple Question:
Download Job Interview Questions and Answers PDF
Write a function:
char * CreateEmptyString(int len);
function should return an pointer to an empty string of length len
Answer:
char * setEmpty(int len){
if (0>len) return NULL;
char * c = (char *) malloc(len+1);
memset(c, 0, len+1);
return c;
}
if (0>len) return NULL;
char * c = (char *) malloc(len+1);
memset(c, 0, len+1);
return c;
}
Download Apple Interview Questions And Answers
PDF
Previous Question | Next Question |
Do you know Which sorting algo you would like to implement as unix library and why? | How to parse a phone number from a huge database of a n billion webpages in 30 minutes |