收藏 分销(赏)

2022年嵌入式工程师面试题经典.doc

上传人:a199****6536 文档编号:7000316 上传时间:2024-12-24 格式:DOC 页数:18 大小:44.54KB
下载 相关 举报
2022年嵌入式工程师面试题经典.doc_第1页
第1页 / 共18页
2022年嵌入式工程师面试题经典.doc_第2页
第2页 / 共18页
2022年嵌入式工程师面试题经典.doc_第3页
第3页 / 共18页
2022年嵌入式工程师面试题经典.doc_第4页
第4页 / 共18页
2022年嵌入式工程师面试题经典.doc_第5页
第5页 / 共18页
点击查看更多>>
资源描述

1、1、将一种字符串逆序 2、将一种链表逆序 3、计算一种字节里(byte)里面有多少bit被置1 4、搜索给定旳字节(byte) 5、在一种字符串中找到也许旳最长旳子字符串 6、字符串转换为整数 7、整数转换为字符串style=MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150% wrap=break-word1、char *strconv(char *p) int i,length; char temp; length = strlen(p); for(i = 0;i length/2;i+) temp = *(p + i); *(p

2、+ i) = *(p + length - 1 - i); *(p +length - 1 - i) = temp; return p;int main() char src100; char *p; scanf(%s,src); p = strconv(src); printf(%sn,p); return 0;style=MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150% wrap=break-word3、int cal(int data) /calculation the number of bit in one byte in

3、t 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 onen,count); return 0;style=MARGIN: 0px; COLOR: rgb(102,102,102); LINE-HEIGHT: 150% wrap=break-word4、#include#includevoid findmax(char *p) int j

4、= 0,max = 0; int count = 0; char record200; char recordmax200; for(int i = 0;i+) if(*(p + i) = ) | (*(p + i) = 0) if(count max) max = count; recordj = 0; strcpy(recordmax,record); count = 0; j = 0; else recordj = *(p + i); count +; j +; if(*(p + i) = 0) break; printf(%sn,recordmax); int main() char

5、str=zeng weidsfdsaf langd hah; printf(%sn,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 goods100; struct shopping *next;SHOP;SHOP *buildlink() /创立链表 char goods100; SHOP *head,*p,*h; p = (

6、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-g

7、oods); 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

8、-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 str50; scanf(%s,str)

9、; 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 goods100; struct shopping *next;SHOP;SHOP *buildlink() /创立链表 char goods100

10、; 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(

11、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 S

12、HOP *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:);

13、char str50; 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.hint myAtoi(char *s);void main() int i; char *s=(char *)malloc(10*size

14、of(char); if (s=NULL) printf(fail to malloc sn); return; while(1) scanf(%s,s); if (*s)=q) break; i = myAtoi(s); printf(%dn,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;

展开阅读全文
部分上传会员的收益排行 01、路***(¥15400+),02、曲****(¥15300+),
03、wei****016(¥13200+),04、大***流(¥12600+),
05、Fis****915(¥4200+),06、h****i(¥4100+),
07、Q**(¥3400+),08、自******点(¥2400+),
09、h*****x(¥1400+),10、c****e(¥1100+),
11、be*****ha(¥800+),12、13********8(¥800+)。
相似文档                                   自信AI助手自信AI助手
搜索标签

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服