没有合适的资源?快使用搜索试试~ 我知道了~
嵌入式工程师笔试题带答案.pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 69 浏览量
2023-10-16
16:19:16
上传
评论
收藏 76KB PDF 举报
温馨提示
试读
37页
嵌入式工程师笔试题带答案.pdf
资源推荐
资源详情
资源评论
1
2
3 byte bit 1
4 (byte)
5
6
7
/* */
#include <iostream>
using namespace std;
//#define NULL ((void *)0)
char * mystrrev(char * const dest,const char * const src)
{
if (dest==NULL && src==NULL)
return NULL;
char *addr = dest;
int val_len = strlen(src);
dest[val_len] = ' ';
int i;
for (i=0; i<val_len; i++)
{
*(dest+i) = *(src+val_len-i-1);
}
return addr;
}
main()
{
char *str="asdfa";
char *str1=NULL;
str1 = (char *)malloc(20);
if (str1 == NULL)
cout<<"malloc failed";
cout<<mystrrev(str1,str);
free(str1);
str1=NULL;//
}
p=head;
q=p->next;
while(q!=NULL)
{
temp=q->next;
q->next=p;
p=q;
q=temp;
}
ok
/* */
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
typedef struct List{
int data;
struct List *next;
}List;
List *list_create(void)
{
struct List *head,*tail,*p;
int e;
head=(List *)malloc(sizeof(List));
tail=head;
printf("\nList Create,input numbers(end of 0):");
scanf("%d",&e);
while(e){
p=(List *)malloc(sizeof(List));
p->data=e;
tail->next=p;
tail=p;
scanf("%d",&e);}
tail->next=NULL;
return head;
}
List *list_reverse(List *head)
{
List *p,*q,*r;
p=head;
q=p->next;
while(q!=NULL)
{
r=q->next;
q->next=p;
p=q;
q=r;
}
head->next=NULL;
head=p;
return head;
}
void main(void)
{
struct List *head,*p;
int d;
head=list_create();
printf("\n");
for(p=head->next;p;p=p->next)
printf("--%d--",p->data);
head=list_reverse(head);
printf("\n");
for(p=head;p->next;p=p->next)
printf("--%d--",p->data);
}
/* N BYTE 1*/
BYTE 1
#incluede<iostream>
#define N 10
// BYTE
#ifndef BYTE
typedef unsigned char BYTE;
#endif
int comb(BYTE b[],int n)
{
int count=0;
int bi,bj;
BYTE cc=1,tt;
// bi BYTE
for(bi=0;bi<n;bi++)
{
// BYTE 8 bit 1
tt=b[bi];
for(bj=0;bj<8;bj++)
{
// 1 2 1 bit 1
//if(tt%2==1)
if((tt&cc)==1)
{
count++;
}
// 2
//tt=tt>>1;
tt=tt/2;
}
}
return count;
}
//
int main()
{
BYTE b[10]={3,3,3,11,1,1,1,1,1,1};
cout<<comb(b,N)<<endl;
return 0;
}
/* C */
char * search(char *cpSource, char ch)
{
char *cpTemp=NULL, *cpDest=NULL;
int iTemp, iCount=0;
while(*cpSource)
{
if(*cpSource == ch)
{
iTemp = 0;
cpTemp = cpSource;
while(*cpSource == ch)
++iTemp, ++cpSource;
if(iTemp > iCount)
iCount = iTemp, cpDest = cpTemp;
if(!*cpSource)
break;
}
++cpSource;
}
return cpDest;
}
#include <stdio.h>
#include <string.h>
//
// MyAtoI
//
// ,
//
int MyAtoI(char str[])
{
int i;
int weight = 1; //
int rtn = 0; //
for(i = strlen(str) - 1; i >= 0; i--)
{
rtn += (str[i] - '0')* weight; //
weight *= 10; //
}
return rtn;
}
void main()
{
char str[32];
printf("Input a string :");
gets(str);
printf("%d\n", MyAtoI(str));
}
#include<stdio.h>
#include<string.h>
void reverse(char s[])
{ //
int c, i=0, j;
for(j=strlen(s)-1;i<j;j--)
{ c=s[i];
s[i]=s[j];
s[j]=c;
i++;
}
}
void IntegerToString(char s[],int n)
{ int i=0,sign;
if((sign=n)<0)//
n=-n;
do // , ,
{
s[i++]=n%10+'0';
}while((n=n/10)>0);
//
if(sign<0)
s[i++]='-';
s[i]='\0';//
reverse(s);
}
void main()
{ int m;
char c[100];
printf(" m: ");
scanf("%d",&m);
IntegerToString(c,m);
printf("integer = %d string = %s\n", m, c);
}
1 C extern static
2 C volatile const
3 typedef define
4 for( 1 )
5do,,while while,,do
6
#include
main()
{
int a,b,c,d;
a=10;
b=a++;
c=++a;
d=10*a++;
printf("b c d%d%d%d"bcd ;
return 0;
}
7 32
typedef union {long i; int k[5]; char c;} DATE;
struct data { int cat; DATE cow; double dog;} too;
DATE max;
printf("%d",sizeof(struct date)+sizeof(max)); _______
8 51
9 C C++
10
剩余36页未读,继续阅读
资源评论
2201_75761617
- 粉丝: 21
- 资源: 7339
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功