当前位置:网站首页>指針經典筆試題
指針經典筆試題
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;
}
边栏推荐
猜你喜欢
Ad20 is set with through-hole direct connection copper sheet, and the bonding pad is cross connected
[leetcode16] the sum of the nearest three numbers (double pointer)
CUDA11.1在线安装
Postman pre script - global variables and environment variables
Codeforces Round #804 (Div. 2)
Implementing fuzzy query with dataframe
Postman断言
[mask requirements of OSPF and Isis in multi access network]
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
Can the feelings of Xi'an version of "Coca Cola" and Bingfeng beverage rush for IPO continue?
随机推荐
Three.js学习-光照和阴影(了解向)
MPLS experiment
[noip2008 improvement group] stupid monkey
RTP gb28181 document testing tool
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
Summary of redis AOF and RDB knowledge points
【LeetCode】18、四数之和
图数据库ONgDB Release v-1.0.3
C# AES对字符串进行加密
[leetcode16] the sum of the nearest three numbers (double pointer)
Compilation and connection of shader in games202 webgl (learn from)
Request (request object) and response (response object)
集合详解之 Collection + 面试题
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
Some common skills on unity inspector are generally used for editor extension or others
ORM aggregate query and native database operation
浅谈镜头滤镜的类型及作用
Configuration file converted from Excel to Lua
RT thread analysis - object container implementation and function
Postman管理测试用例