当前位置:网站首页>Pointer classic written test questions
Pointer classic written test questions
2022-07-06 05:13:00 【Cloud C】
List of articles
Written test question 1
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;
}
// What is the result of the program ?
Question 2 of the written examination
// The size of the structure is 20 Bytes
struct Test
{
int Num;
char *pcName;
short sDate;
char cha[2];
short sBa[4];
}*p;
// hypothesis p The value of is 0x100000. What are the values of the expressions in the following table ?
int main()
{
printf("%p\n", p + 0x1);
printf("%p\n", (unsigned long)p + 0x1);
printf("%p\n", (unsigned int*)p + 0x1);
return 0;
}
Written test question 3
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;
}
Written test question 4
#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;
}
Written test question five
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;
}
Written test question six
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;
}
Written test question 7
#include <stdio.h>
int main()
{
char *a[] = {
"work","at","alibaba"};
char**pa = a;
pa++;
printf("%s\n", *pa);
return 0;
}
Written test question 8
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;
}
边栏推荐
- Vite configures the development environment and production environment
- Postman前置脚本-全局变量和环境变量
- In 2022, we must enter the big factory as soon as possible
- flutter 实现一个有加载动画的按钮(loadingButton)
- CUDA11.1在线安装
- GAMES202-WebGL中shader的編譯和連接(了解向)
- Three.js学习-光照和阴影(了解向)
- 你需要知道的 TCP 三次握手
- Configuration file converted from Excel to Lua
- [classic example] binary tree recursive structure classic topic collection @ binary tree
猜你喜欢
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
acwing周赛58
Weng Kai C language third week 3.1 punch in
[leetcode] 18. Sum of four numbers
Postman断言
Basic knowledge and examples of binary tree
ISP learning (2)
flutter 实现一个有加载动画的按钮(loadingButton)
Golang -- TCP implements concurrency (server and client)
[mathematical modeling] differential equation -- sustainable development of fishing industry
随机推荐
[lgr-109] Luogu may race II & windy round 6
Force buckle 1189 Maximum number of "balloons"
C# AES对字符串进行加密
MySQL advanced learning summary 9: create index, delete index, descending index, and hide index
2021 RoboCom 世界机器人开发者大赛-本科组(复赛)
[buuctf.reverse] 159_[watevrCTF 2019]Watshell
Sliding window problem review
Request (request object) and response (response object)
A little knowledge of CPU, disk and memory
[effective Objective-C] - memory management
Application of Flody
Upload nestjs configuration files, configure the use of middleware and pipelines
Quelques conseils communs sur l'inspecteur de l'unit é, généralement pour les extensions d'éditeur ou d'autres
What are the advantages of the industry private network over the public network? What specific requirements can be met?
Class inheritance in yyds dry inventory C
Yolov5 tensorrt acceleration
Some common skills on unity inspector are generally used for editor extension or others
Postman assertion
Configuration file converted from Excel to Lua
Why does MySQL need two-phase commit