当前位置:网站首页>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;
}


边栏推荐
- Fuzzy -- basic application method of AFL
- JS quick start (II)
- [mask requirements of OSPF and Isis in multi access network]
- 行业专网对比公网,优势在哪儿?能满足什么特定要求?
- Force buckle 1189 Maximum number of "balloons"
- The web project imported the MySQL driver jar package but failed to load it into the driver
- Simple understanding of interpreters and compilers
- C AES encrypts strings
- The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder
- Mysql高级篇学习总结9:创建索引、删除索引、降序索引、隐藏索引
猜你喜欢

Simple understanding of interpreters and compilers

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?

Yyds dry inventory SSH Remote Connection introduction

Huawei equipment is configured with OSPF and BFD linkage
![[lgr-109] Luogu may race II & windy round 6](/img/fe/d5b67c7dff759c519a04da023630ea.png)
[lgr-109] Luogu may race II & windy round 6

Why does MySQL need two-phase commit

从0到1建设智能灰度数据体系:以vivo游戏中心为例

Weng Kai C language third week 3.1 punch in

CUDA11.1在线安装
随机推荐
Nestjs配置文件上传, 配置中间件以及管道的使用
A little knowledge of CPU, disk and memory
Orm-f & Q object
JS quick start (II)
树莓派3.5寸屏幕白屏显示连接
Nacos - TC Construction of High available seata (02)
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
ORM aggregate query and native database operation
行业专网对比公网,优势在哪儿?能满足什么特定要求?
idea一键导包
Review of double pointer problems
Sorting out the knowledge points of multicast and broadcasting
趋势前沿 | 达摩院语音 AI 最新技术大全
關於Unity Inspector上的一些常用技巧,一般用於編輯器擴展或者其他
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
RT thread analysis - object container implementation and function
Modbus protocol communication exception
Quelques conseils communs sur l'inspecteur de l'unit é, généralement pour les extensions d'éditeur ou d'autres
Microblogging hot search stock selection strategy
L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires