导航

微软笔试试题——11月13日,2005年

Posted on 2005-11-14 11:11  经霄  阅读(1236)  评论(0)    收藏  举报

Please examine the following code carefully.List any possible bugs in this code and correct the bugs.
#define mkupper(c) ((c)-'a'+'A')
void StringToUpper(char *pStr)
{
   while(pStr)
   {
       *pStr = mkupper(*pStr);
       pStr++;
   }
}
int main()
{
    char *tmp = "aBcdef";
    StringToUpper(tmp);
    return 0;
}



void _cdecl _assert(
    const char *expr;
    const char *filename,
    unsigned lineno
   )
_assert() will display a message and abort
list test cases you would design if you were asked to test the following function.