当前位置:网站首页>C and pointers Chapter 18 runtime environment 18.8 programming exercises
C and pointers Chapter 18 runtime environment 18.8 programming exercises
2022-07-27 00:15:00 【weixin_ Guest time】
1. Write an assembly language program for your system , It accepts 3 Integer parameters and return their sum .
analysis :
Leave it to be proved later :
2. Write an assembly language program , establish 3 An integer value and call printf The function prints them out .
analysis :
Leave it to be proved later :
3. Assume stdarg.h The file was accidentally deleted from your file . Please write a group of 7 Described in Chapter stdarg macro .
analysis :
The answer actually depends on the specific environment . However, the solution here applies to the environment discussed in this chapter . The user must provide the actual type of the parameter after the standard type conversion . real stdarg.h That's what macros do .
/*
** Standard library files stdarg.h Alternatives to defined macros .
*/
/*
** va_list
** Type a variable that holds a pointer to the variable part of the parameter list . What we use here is char *,
** Because the operations acting on them have not been adjusted .
*/
typdef char *va_list;
/*
** va_start
** Used to initialize a va_list Macro of variable , Make it point to... In the stack 1 A variable parameter .
*/
#define va_start( arg_ptr, arg ) arg_ptr = (char *)&arg + sizeof(arg)
/*
** va_arg
** Macro used to return the value of the next variable in the stack , It increases at the same time arg_ptr Value , Make it point to the next parameter .
*/
#define va_arg( arg_ptr, type ) *((type *)arg_ptr)++
/*
** va_end
** Called after the last access of the variable parameter . In this environment , It doesn't need to perform any tasks .
*/
#define va_end( arg_ptr )
边栏推荐
- In depth interpretation of the investment logic of the consortium's participation in the privatization of Twitter
- 机器学习模型——lightGBM
- 4-4 对象生命周期
- LeetCode——哈希表篇
- PTA 7-1 play with binary tree
- 第2章 开发用户流量拦截器
- Bid farewell to wide tables and achieve a new generation of Bi with DQL
- Codeforces E. maximum subsequence value (greed + pigeon nest principle)
- Design of electronic scale based on 51 single chip microcomputer
- Halloween treatments (drawer principle)
猜你喜欢

New features of ES6

文件上传到OSS文件服务器

Dynamic SQL

带你熟悉云网络的“电话簿”:DNS

MySQL optimization

About no module named'django.db.backends.mysql'

In simple terms, cchart daily lesson - happy high school lesson 57 new starting point, the old tree and new bud of colorful interface library

Azure synapse analytics Performance Optimization Guide (3) -- optimize performance using materialized views (Part 2)

Transformers is a graph neural network

Midge paper reading notes
随机推荐
Complex SQL_ 01
12_ Binding style
11_ Weather case - monitoring properties
Simple SQL optimization
Share a regular expression
MVC三层架构
Azure Synapse Analytics 性能优化指南(3)——使用具体化视图优化性能(下)
带你熟悉云网络的“电话簿”:DNS
三层架构 模拟
uni-app学习(二)
Galaxy securities online account opening commission, is online account opening safe for customer managers
Dynamic memory management
Complete backpack and 01 Backpack
第1章 拦截器入门及使用技巧
Typesript generic constraint
MySQL optimization
第2章 开发用户流量拦截器
JUnit、JMockit、Mockito、PowerMockito
4-4 object lifecycle
Flink SQL (II) Kafka connector