• /  18
  • 下載費用: 9.90積分  

嵌入式工程師面試題--經典.doc

'嵌入式工程師面試題--經典.doc'
?1、將一個字符串逆序 2、將一個鏈表逆序 3、計算一個字節里(byte)里面有多少bit被置1 4、搜索給定的字節(byte) 5、在一個字符串中找到可能的最長的子字符串 6、字符串轉換為整數 7、整數轉換為字符串style="MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150%" wrap="break-word"1、char *strconv(char *p){ int i,length; char temp; length = strlen(p); for(i = 0;i < length/2;i++) { temp = *(p + i); *(p + i) = *(p + length - 1 - i); *(p +length - 1 - i) = temp; } return p;}int main(){ char src[100]; char *p; scanf("%s",src); p = strconv(src); printf("%s\n",p); return 0;}style="MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150%" wrap="break-word"3、int cal(int data) //calculation the number of bit in one byte{ int a; int count = 0; a = data % 100; while (a != 0) { count += a % 2; a /= 2; } return count;}int main(){ int d,count; scanf("%d",&d); count = cal(d); printf("%d of one\n",count); return 0;}style="MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150%" wrap="break-word"4、#include#includevoid findmax(char *p){ int j = 0,max = 0; int count = 0; char record[200]; char recordmax[200]; for(int i = 0;;i++) { if((*(p + i) == ' ') || (*(p + i) == '\0')) { if(count > max) { max = count; record[j] = '\0'; strcpy(recordmax,record); } count = 0; j = 0; } else { record[j] = *(p + i); count ++; j ++; } if(*(p + i) == '\0') break; } printf("%s\n",recordmax);}int main(){ char str[]="zeng weidsfdsaf langd hah"; printf("%s\n",str); findmax(str); return 0;}style="MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150%" wrap="break-word"#include#include#includetypedef struct shopping{ char goods[100]; struct shopping *next;}SHOP;SHOP *buildlink() //創建鏈表{ char goods[100]; SHOP *head,*p,*h; p = (SHOP *)malloc(sizeof(SHOP)); head = p; head->next = NULL; printf("Input three goods:"); for(int i = 0;i goods,goods); p->next = NULL; if(head->next == NULL) { head->next = p; h = p; } else { h->next = p; h = h->next; } } return head;}void showlink(SHOP *head) //顯示鏈表{ SHOP *p; p = head->next; while(p != NULL) { printf("%s ",p->goods); p = p->next; } printf("\n");}SHOP *revlink(SHOP *head) //反轉鏈表{ SHOP *p,*newp; p = head->。省略部分。lete a node:"); char str[50]; scanf("%s",str); int i; i = delnode(head,str); showlink(head); if(i == 1) printf("Delete successful!\n"); return 0;}style="MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150%" wrap="break-word"#include#include#includetypedef struct shopping{ char goods[100]; struct shopping *next;}SHOP;SHOP *buildlink() //創建鏈表{ char goods[100]; SHOP *head,*p,*h; p = (SHOP *)malloc(sizeof(SHOP)); head = p; head->next = NULL; printf("Input three goods:"); for(int i = 0;i goods,goods); p->next = NULL; if(head->next == NULL) { head->next = p; h = p; } else { h->next = p; h = h->next; } } return head;}void showlink(SHOP *head) //顯示鏈表{ SHOP *p; p = head->next; while(p != NULL) { printf("%s ",p->goods); p = p->next; } printf("\n");}SHOP *revlink(SHOP *head) //反轉鏈表{ SHOP *p,*newp; p = head->next; head->next = NULL; while(p != NULL) { newp = p; p = p->next; newp->next = head->next; head->next = newp; } return head;}int delnode(SHOP *head,char *str){ //delete success return 1,else return 0 SHOP *q,*p = head; while(p->next != NULL) { q = p; p = p->next; if(!strcmp(str,p->goods)) { q->next = p->next; free(p); //p = q->next; return 1; } } return 0;}int main(){ SHOP *head; SHOP *newhead; head = buildlink(); showlink(head); newhead = revlink(head); showlink(newhead); showlink(head); printf("Delete a node:"); char str[50]; scanf("%s",str); int i; i = delnode(head,str); showlink(head); if(i == 1) printf("Delete successful!\n"); return 0;}style="MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150%" wrap="break-word"#include "stdio.h"#include "stdlib.h"int myAtoi(char *s);void main(){ int i; char *s=(char *)malloc(10*sizeof(char)); if (s==NULL) { printf("fail to malloc s\n"); return; } while(1) { scanf("%s",s); if ((*s)=='q') { break; } i = myAtoi(s); printf("%d\n",i); }}int myAtoi(char *s){ int i=0; int flag=0; if (s==NULL)return 0; if (*s=='+'||*s=='-') { if (*s=='-') { flag=1; } s++; } while(*s!='\0' && *s>='0' && *s<='9') { i=(int)(*s)-'0'+i*10; s++; } if (flag)i=-i; return i;}
關 鍵 詞:
面試 嵌入 經典 工程師
 天天文庫所有資源均是用戶自行上傳分享,僅供網友學習交流,未經上傳用戶書面授權,請勿作他用。
關于本文
本文標題:嵌入式工程師面試題--經典.doc
鏈接地址: http://www.476824.live/p-51578982.html
關于我們 - 網站聲明 - 網站地圖 - 資源地圖 - 友情鏈接 - 網站客服點擊這里,給天天文庫發消息,QQ:1290478887 - 聯系我們

本站為“文檔C2C交易模式”,即用戶上傳的文檔直接賣給(下載)用戶,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有【成交的100%(原創)】。本站是網絡服務平臺方,若您的權利被侵害,侵權客服QQ:1290478887 歡迎舉報。

[email protected] 2017-2027 http://www.476824.live 網站版權所有

粵ICP備19057495號 

收起
展開
球探网即时蓝球比分 内蒙古11选五任5遗漏 银行股票涨跌由什么决定 股票涨停后可以买吗 江苏十一选五走势图表 同花顺炒股软件下载 体彩排列三开奖结果 上海天天彩选4开奖 股票涨跌的本质 江西十一选五稳定计划 广东福彩公众号投注