当前位置:网站首页>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;
}
边栏推荐
- Class inheritance in yyds dry inventory C
- Biscuits (examination version)
- UCF(暑期团队赛二)
- [noip2009 popularization group] score line delimitation
- JS quick start (II)
- 【LGR-109】洛谷 5 月月赛 II & Windy Round 6
- Compilation et connexion de shader dans games202 - webgl (comprendre la direction)
- 你需要知道的 TCP 三次握手
- Nestjs配置文件上传, 配置中间件以及管道的使用
- 2021robocom robot developer competition (Preliminary)
猜你喜欢
Pagoda configuration mongodb
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
[leetcode daily question] number of enclaves
Basic knowledge and examples of binary tree
【LGR-109】洛谷 5 月月赛 II & Windy Round 6
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
TCP three handshakes you need to know
GAMES202-WebGL中shader的編譯和連接(了解向)
[classic example] binary tree recursive structure classic topic collection @ binary tree
idea一键导包
随机推荐
Implementing fuzzy query with dataframe
Using stopwatch to count code time
Extension of graph theory
Flody的应用
flutter 实现一个有加载动画的按钮(loadingButton)
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
Postman前置脚本-全局变量和环境变量
JS quick start (II)
[buuctf.reverse] 159_ [watevrCTF 2019]Watshell
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
Codeforces Round #804 (Div. 2)
Codeforces Round #804 (Div. 2) Editorial(A-B)
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
图论的扩展
Zynq learning notes (3) - partial reconfiguration
What are the advantages of the industry private network over the public network? What specific requirements can be met?
用StopWatch 统计代码耗时
Set detailed map + interview questions
Why does MySQL need two-phase commit
集合详解之 Collection + 面试题