当前位置:网站首页>指針經典筆試題
指針經典筆試題
2022-07-06 05:13:00 【雲朵c】
筆試題一
int main()
{
int a[5] = {
1,2,3,4,5 };
int* ptr = (int*)(&a + 1);
printf("%d\n", *(a + 1));
printf("%d\n", *(ptr - 1));
return 0;
}
//程序的結果是什麼?
筆試題二
//結構體的大小是20個字節
struct Test
{
int Num;
char *pcName;
short sDate;
char cha[2];
short sBa[4];
}*p;
//假設p的值為0x100000。 如下錶錶達式的值分別為多少?
int main()
{
printf("%p\n", p + 0x1);
printf("%p\n", (unsigned long)p + 0x1);
printf("%p\n", (unsigned int*)p + 0x1);
return 0;
}
筆試題三
int main()
{
int a[4] = {
1, 2, 3, 4 };
int *ptr1 = (int *)(&a + 1);
int *ptr2 = (int *)((int)a + 1);
printf("%x\n", ptr1[-1]);
printf("%x\n", *ptr2);
return 0;
}
筆試題四
#include <stdio.h>
int main()
{
int a[3][2] = {
(0, 1), (2, 3), (4, 5) };
int *p;
p = a[0];
printf( "%d", p[0]);
return 0;
}
筆試題五
int main()
{
int a[5][5];
int(*p)[4];
p = a;
printf("%p\n", &p[4][2] - &a[4][2]);
printf("%d\n", &p[4][2] - &a[4][2]);
return 0;
}
筆試題六
int main()
{
int aa[2][5] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int* ptr1 = (int*)(&aa + 1);
int* ptr2 = (int*)(*(aa + 1));
printf("%d\n", *(ptr1 - 1));
printf("%d\n", *(ptr2 - 1));
return 0;
}
筆試題七
#include <stdio.h>
int main()
{
char *a[] = {
"work","at","alibaba"};
char**pa = a;
pa++;
printf("%s\n", *pa);
return 0;
}
筆試題八
int main()
{
char *c[] = {
"ENTER","NEW","POINT","FIRST"};
char**cp[] = {
c+3,c+2,c+1,c};
char***cpp = cp;
printf("%s\n", **++cpp);
printf("%s\n", *--*++cpp+3);
printf("%s\n", *cpp[-2]+3);
printf("%s\n", cpp[-1][-1]+1);
return 0;
}
边栏推荐
- Upload nestjs configuration files, configure the use of middleware and pipelines
- Flink kakfa data read and write to Hudi
- Excel转换为Lua的配置文件
- 2021 robocom world robot developer competition - undergraduate group (semi-finals)
- 饼干(考试版)
- 组播和广播的知识点梳理
- Yolov5 tensorrt acceleration
- Imperial cms7.5 imitation "D9 download station" software application download website source code
- Rce code and Command Execution Vulnerability
- 趋势前沿 | 达摩院语音 AI 最新技术大全
猜你喜欢
趋势前沿 | 达摩院语音 AI 最新技术大全
[lgr-109] Luogu may race II & windy round 6
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
What are the advantages of the industry private network over the public network? What specific requirements can be met?
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
idea一键导包
Vite configures the development environment and production environment
Modbus协议通信异常
你需要知道的 TCP 三次握手
随机推荐
Postman pre script - global variables and environment variables
集合详解之 Map + 面试题
Extension of graph theory
What are the advantages of the industry private network over the public network? What specific requirements can be met?
Codeforces Round #804 (Div. 2)
Driver development - hellowdm driver
Pagoda configuration mongodb
Postman关联
图论的扩展
Leetcode dynamic planning day 16
Zynq learning notes (3) - partial reconfiguration
Idea one key guide package
The video in win10 computer system does not display thumbnails
Orm-f & Q object
Collection + interview questions
Fiddler installed the certificate, or prompted that the certificate is invalid
Talking about the type and function of lens filter
GAMES202-WebGL中shader的编译和连接(了解向)
Summary of three log knowledge points of MySQL
Leetcode 186 Flip the word II in the string (2022.07.05)