+ -
当前位置:首页 → 问答吧 → 求高手给个价,能写这样代码的程序员月薪应该给多少?

求高手给个价,能写这样代码的程序员月薪应该给多少?

时间:2010-07-21

来源:互联网

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <assert.h>
  5. struct helloworld_t
  6. {
  7.     int num;
  8.     char helloworld[0];
  9. };

  10. int main()
  11. {
  12.     struct helloworld_t *p;
  13.     unsigned int size = sizeof(struct helloworld_t) + strlen("Hello World!\n") + 1;
  14.     p = (struct helloworld_t *) malloc(size);
  15.     assert(p!=NULL);

  16.     memcpy((void *)p, (void *)"\x01\x00\x00\x00Hello World!\n", size);

  17.     while (p->num--)
  18.     {
  19.         printf(p->helloworld);
  20.     }
  21.    
  22.     free((void *)p);
  23.     return 0;
  24. }
复制代码

作者: zhangsuozhu   发布时间: 2010-07-21

我能写,你给多少钱?

作者: prolj   发布时间: 2010-07-21

算有点小聪明,但习惯不好的那种

作者: hellioncu   发布时间: 2010-07-21

从中可以看出。该程序员对内存、零长数组、主机字节序。认识的还是比较到位的!应该有二到三年的实际工作经验!

作者: zhangsuozhu   发布时间: 2010-07-21

我不光对这些认识的很到位,对更多的下面的东西认识的更到位。

作者: prolj   发布时间: 2010-07-21

回复 prolj


    比如人体工程学

作者: cookis   发布时间: 2010-07-21

memcpy((void *)p, (void *)"\x01\x00\x00\x00Hello World!\n", size); 此句有问题。带来不确定因素。因为:

struct helloworld_t
{
     int num;
     char helloworld[0];
};

int 的长度在不同机型上应该不同吧。   还有。有机器是大端字节序的。所以会循环很多次.所以,该程序员应该不合适当嵌入式程序员

作者: zhangsuozhu   发布时间: 2010-07-21