STA双WiFi连接

news2024/11/15 3:41:49

STA双WiFi连接

  • 1、STA/STA双WiFi开关
    • 1.1 相关属性
    • 1.2 STA/STA支持判断
  • 2、STA双WiFi命令测试
    • 2.1 adb shell cmd wifi add-suggestion guest_5G wpa3 12345678 -p
    • 2.2 adb shell cmd wifi remove-suggestion guest_5G
    • 2.3 查看dumpsys wifi信息WifiConfigStore
  • 3、STA双WiFi连接流程
    • 3.1 STA双WiFi请求前准备工作
    • 3.2 STA双WiFi连接时序图

Wi-Fi STA/STA 并发:Android 12 引入了 Wi-Fi STA/STA 并发功能,使设备可同时连接到两个 Wi-Fi 网络


1、STA/STA双WiFi开关

1.1 相关属性

packages/modules/Wifi/service/ServiceWifiResources/res/values/config.xml

<!-- Enable Make-Before-Break Wifi network switching.
     Note: this is conditional on the device supporting dual concurrent STAs. -->
<bool translatable="false" name="config_wifiMultiStaNetworkSwitchingMakeBeforeBreakEnabled">false</bool>
<!-- Enable concurrent peer to peer + internet connectivity
     Note: this is conditional on the device supporting dual concurrent STAs. -->
<bool translatable="false" name="config_wifiMultiStaLocalOnlyConcurrencyEnabled">false</bool>
<!-- Enable concurrent restricted connectivity + internet connectivity
     Note: this is conditional on the device supporting dual concurrent STAs. -->
<bool translatable="false" name="config_wifiMultiStaRestrictedConcurrencyEnabled">false</bool>
<!-- Enable concurrent internet connectivity + internet connectivity
     Note: this is conditional on the device supporting dual concurrent STAs. -->
<bool translatable="false" name="config_wifiMultiStaMultiInternetConcurrencyEnabled">false</bool>

1.2 STA/STA支持判断

  • mWifiManager.isWifiEnabled() WIFI开关是否打开
  • mWifiManager.isStaConcurrencyForMultiInternetSupported() 属性config_wifiMultiStaMultiInternetConcurrencyEnabled配置
  • mWifiManager.getStaConcurrencyForMultiInternetMode() == WifiManager.WIFI_MULTI_INTERNET_MODE_MULTI_AP 模式双WIFI STA/STA开关是否打开(模式设置setStaConcurrencyForMultiInternetMode
  • WifiManager#WIFI_MULTI_INTERNET_MODE_DBS_AP:限制与 DBS AP 的双频的并发连接。
  • WifiManager#WIFI_MULTI_INTERNET_MODE_MULTI_AP:连接到任意 AP,其中的各个连接使用不同的频段。
  • WifiManager#WIFI_MULTI_INTERNET_MODE_DISABLED:停用功能。

2、STA双WiFi命令测试

adb shell cmd wifi
(Android framework服务命令行工具框架 - Android13)

packages/modules/Wifi/service/java/com/android/server/wifi/WifiShellCommand.java

  • 启用详细日志记录:adb shell cmd wifi set-verbose-logging enabled
  • 清理旧的wifi建议(如果有的话):adb shell cmd wifi remove-all-suggestions
    adb shell cmd wifi list-all-suggestions
  • WiFi连接状态查询:adb shell cmd wifi status | grep -E "==|connected to"
==== ClientModeManager instance: ConcreteClientModeManager{id=33409 iface=wlan0 role=ROLE_CLIENT_PRIMARY} ====
Wifi is connected to "guest_5G"
==== ClientModeManager instance: ConcreteClientModeManager{id=82271673 iface=wlan1  role=ROLE_CLIENT_SECONDARY_LONG_LIVED} ====
Wifi is connected to "guest"
  • 添加WifiNetworkSuggestion网络连接:adb shell cmd wifi add-suggestion guest_5G wpa3 12345678 -p
  • 执行网络扫描:adb shell cmd wifi start-scan
  • 断开移除WifiNetworkSuggestion网络:adb shell cmd wifi remove-suggestion guest_5G

2.1 adb shell cmd wifi add-suggestion guest_5G wpa3 12345678 -p

添加WifiNetworkSuggestion网络连接:

  1. 参数guest_5G wpa3 12345678 网络名称、类型、密码
  2. 参数-p(或-o)设置 setOemPaid(true)setOemPrivate(true)
    (设备能够连接到副Wi-Fi网络:添加 Wi-Fi 网络建议,方法是将 setOemPaid 或 setOemPrivate 设置为 true。)
  3. mConnectivityManager.requestNetwork(networkRequest, networkCallback)TRANSPORT_WIFI网络请求
    (在 ConnectivityManager 中,提交具有相应功能的 NetworkRequest:为 setOemPaid 提交 NET_CAPABILITY_OEM_PAID 功能(为 setOemPrivate 提交 NET_CAPABILITY_OEM_PRIVATE 功能))
case "add-suggestion": {
    WifiNetworkSuggestion suggestion = buildSuggestion(pw);
    if (suggestion  == null) {
        pw.println("Invalid network suggestion parameter");
        return -1;
    }
    int errorCode = mWifiService.addNetworkSuggestions(
            Arrays.asList(suggestion), SHELL_PACKAGE_NAME, null);
    if (errorCode != WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS) {
        pw.println("Add network suggestion failed with error code: " + errorCode);
        return -1;
    }
    // untrusted/oem-paid networks need a corresponding NetworkRequest.
    if (suggestion.isUntrusted()
            || (SdkLevel.isAtLeastS()
            && (suggestion.isOemPaid() || suggestion.isOemPrivate()))) {
        NetworkRequest.Builder networkRequestBuilder =
                new NetworkRequest.Builder()
                        .addTransportType(TRANSPORT_WIFI);
        if (suggestion.isUntrusted()) {
            networkRequestBuilder.removeCapability(NET_CAPABILITY_TRUSTED);
        }
        if (SdkLevel.isAtLeastS()) {
            if (suggestion.isOemPaid()) {
                networkRequestBuilder.addCapability(NET_CAPABILITY_OEM_PAID);
            }
            if (suggestion.isOemPrivate()) {
                networkRequestBuilder.addCapability(NET_CAPABILITY_OEM_PRIVATE);
            }
        }
        NetworkRequest networkRequest = networkRequestBuilder.build();
        ConnectivityManager.NetworkCallback networkCallback =
                new ConnectivityManager.NetworkCallback();
        pw.println("Adding request: " + networkRequest);
        mConnectivityManager.requestNetwork(networkRequest, networkCallback);
        sActiveRequests.put(
                suggestion.getSsid(), Pair.create(networkRequest, networkCallback));
    }
    return 0;
}

//解析网络参数
    private WifiNetworkSuggestion buildSuggestion(PrintWriter pw) {
        String ssid = getNextArgRequired();
        String type = getNextArgRequired();
        WifiNetworkSuggestion.Builder suggestionBuilder =
                new WifiNetworkSuggestion.Builder();
        suggestionBuilder.setSsid(ssid);
        if (TextUtils.equals(type, "wpa3")) {
            suggestionBuilder.setWpa3Passphrase(getNextArgRequired());
        } else if (TextUtils.equals(type, "wpa2")) {
            suggestionBuilder.setWpa2Passphrase(getNextArgRequired());
        } else if (TextUtils.equals(type, "owe")) {
            suggestionBuilder.setIsEnhancedOpen(true);
        } else if (TextUtils.equals(type, "open")) {
            // nothing to do.
        } else {
            throw new IllegalArgumentException("Unknown network type " + type);
        }
        boolean isCarrierMerged = false;
        String option = getNextOption();
        while (option != null) {
            if (option.equals("-u")) {
                suggestionBuilder.setUntrusted(true);
            } else if (option.equals("-o")) {
                if (SdkLevel.isAtLeastS()) {
                    suggestionBuilder.setOemPaid(true);
                } else {
                    throw new IllegalArgumentException(
                            "-o OEM paid suggestions not supported before S");
                }
            } else if (option.equals("-p")) {
                if (SdkLevel.isAtLeastS()) {
                    suggestionBuilder.setOemPrivate(true);
                } else {
                    throw new IllegalArgumentException(
                            "-p OEM private suggestions not supported before S");
                }
            } else if (option.equals("-m")) {
                suggestionBuilder.setIsMetered(true);
            } else if (option.equals("-s")) {
                suggestionBuilder.setCredentialSharedWithUser(true);
            } else if (option.equals("-d")) {
                suggestionBuilder.setIsInitialAutojoinEnabled(false);
            } else if (option.equals("-b")) {
                suggestionBuilder.setBssid(MacAddress.fromString(getNextArgRequired()));
            } else if (option.equals("-r")) {
                if (SdkLevel.isAtLeastS()) {
                    suggestionBuilder.setMacRandomizationSetting(
                            WifiNetworkSuggestion.RANDOMIZATION_NON_PERSISTENT);
                } else {
                    throw new IllegalArgumentException(
                            "-r non_persistent MAC randomization not supported before S");
                }
            } else if (option.equals("-a")) {
                if (SdkLevel.isAtLeastS()) {
                    isCarrierMerged = true;
                } else {
                    throw new IllegalArgumentException("-a option is not supported before S");
                }
            } else if (option.equals("-i")) {
                if (SdkLevel.isAtLeastS()) {
                    int subId = Integer.parseInt(getNextArgRequired());
                    suggestionBuilder.setSubscriptionId(subId);
                } else {
                    throw new IllegalArgumentException(
                            "-i subscription ID option is not supported before S");
                }
            } else if (option.equals("-c")) {
                int carrierId = Integer.parseInt(getNextArgRequired());
                suggestionBuilder.setCarrierId(carrierId);
            } else if (option.equals("-h")) {
                suggestionBuilder.setIsHiddenSsid(true);
            } else {
                pw.println("Ignoring unknown option " + option);
            }
            option = getNextOption();
        }
        WifiNetworkSuggestion suggestion = suggestionBuilder.build();
        if (isCarrierMerged) {
            if (suggestion.wifiConfiguration.subscriptionId
                    == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
                pw.println("Carrier merged network must have valid subscription Id");
                return null;
            }
            suggestion.wifiConfiguration.carrierMerged = true;
        }
        return suggestion;
    }

2.2 adb shell cmd wifi remove-suggestion guest_5G

断开移除WifiNetworkSuggestion网络:

  1. mConnectivityManager.unregisterNetworkCallback(nrAndNc.second):移除请求时的NetworkCallback就可以断开WiFi网络
  2. mWifiService.removeNetworkSuggestions():移除WifiNetworkSuggestion网路信息,这里就会移除WifiConfigStoreNetworkSuggestions.xml保存信息
case "remove-suggestion": {
    String ssid = getNextArgRequired();
    String action = getNextArg();
    int actionCode = ACTION_REMOVE_SUGGESTION_DISCONNECT;
    if (action != null && action.equals("lingering")) {
        actionCode = ACTION_REMOVE_SUGGESTION_LINGER;
    }
    List<WifiNetworkSuggestion> suggestions =
            mWifiService.getNetworkSuggestions(SHELL_PACKAGE_NAME);
    WifiNetworkSuggestion suggestion = suggestions.stream()
            .filter(s -> s.getSsid().equals(ssid))
            .findAny()
            .orElse(null);
    if (suggestion == null) {
        pw.println("No matching suggestion to remove");
        return -1;
    }
    mWifiService.removeNetworkSuggestions(
            Arrays.asList(suggestion), SHELL_PACKAGE_NAME, actionCode);
    // untrusted/oem-paid networks need a corresponding NetworkRequest.
    if (suggestion.isUntrusted()
            || (SdkLevel.isAtLeastS()
            && (suggestion.isOemPaid() || suggestion.isOemPrivate()))) {
        Pair<NetworkRequest, ConnectivityManager.NetworkCallback> nrAndNc =
                sActiveRequests.remove(suggestion.getSsid());
        if (nrAndNc == null) {
            pw.println("No matching request to remove");
            return -1;
        }
        pw.println("Removing request: " + nrAndNc.first);
        mConnectivityManager.unregisterNetworkCallback(nrAndNc.second);
    }
    return 0;
}

2.3 查看dumpsys wifi信息WifiConfigStore

packages/modules/Wifi/service/java/com/android/server/wifi/WifiConfigStore.java
packages/modules/Wifi/service/java/com/android/server/wifi/WifiConfigManager.java
packages/modules/Wifi/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java

Dump of WifiConfigStore
WifiConfigStore - Store File Begin ----
Name: /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml, File Id: 0, Credentials encrypted: false
Name: /data/misc/apexdata/com.android.wifi/WifiConfigStoreSoftAp.xml, File Id: 1, Credentials encrypted: false
Name: /data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml, File Id: 2, Credentials encrypted: false
Name: /data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStoreNetworkSuggestions.xml, File Id: 3, Credentials encrypted: false
WifiConfigStore - Store Data Begin ----

3、STA双WiFi连接流程

3.1 STA双WiFi请求前准备工作

  1. 设置setOemPaidsetOemPrivate,并mWifiService.addNetworkSuggestions 添加WifiNetworkSuggestion信息
  2. NetworkRequest请求信息添加TRANSPORT_WIFINET_CAPABILITY_OEM_PRIVATE(或NET_CAPABILITY_OEM_PAID
  3. mConnectivityManager.requestNetwork(networkRequest, networkCallback) 请网络,networkCallback监听连接状态(断开是注销networkCallback
  4. 请求执行到OemWifiNetworkFactory.java#needNetworkForOemPaidWifiNetworkFactory有挂起的网络请求触发,设置mOemPaidConnectionAllowed、mOemPaidConnectionRequestorWs,并开启自动联接setAutoJoinEnabled和启动连接性扫描startConnectivityScan

packages/modules/Wifi/service/java/com/android/server/wifi/OemWifiNetworkFactory.java

protected void needNetworkFor(NetworkRequest networkRequest) {
    if (networkRequest.hasCapability(NetworkCapabilities.NET_CAPABILITY_OEM_PAID)) {
        mOemPaidConnectionReqCount++;
        if (mOemPaidConnectionReqCount == 1) {
            mWifiConnectivityManager.setOemPaidConnectionAllowed(
                    true, new WorkSource(networkRequest.getRequestorUid(),
                            networkRequest.getRequestorPackageName()));
        }
    }
    if (networkRequest.hasCapability(NetworkCapabilities.NET_CAPABILITY_OEM_PRIVATE)) {
        mOemPrivateConnectionReqCount++;
        if (mOemPrivateConnectionReqCount == 1) {
            mWifiConnectivityManager.setOemPrivateConnectionAllowed(
                    true, new WorkSource(networkRequest.getRequestorUid(),
                            networkRequest.getRequestorPackageName()));
        }
    }
}

packages/modules/Wifi/service/java/com/android/server/wifi/WifiConnectivityManager.java

public void setOemPaidConnectionAllowed(boolean allowed, WorkSource requestorWs) {
    localLog("setOemPaidConnectionAllowed: allowed=" + allowed + ", requestorWs="
            + requestorWs);

    if (mOemPaidConnectionAllowed != allowed) {
        mOemPaidConnectionAllowed = allowed;
        mOemPaidConnectionRequestorWs = requestorWs;
        checkAllStatesAndEnableAutoJoin();
    }
}

private void checkAllStatesAndEnableAutoJoin() {
    // if auto-join was disabled externally, don't re-enable for any triggers.
    // External triggers to disable always trumps any internal state.
    setAutoJoinEnabled(mAutoJoinEnabledExternal
            && (mUntrustedConnectionAllowed || mOemPaidConnectionAllowed
            || mOemPrivateConnectionAllowed || mTrustedConnectionAllowed
            || mRestrictedConnectionAllowedUids.size() != 0 || hasMultiInternetConnection())
            && !mSpecificNetworkRequestInProgress);
    startConnectivityScan(SCAN_IMMEDIATELY);
}

3.2 STA双WiFi连接时序图

接收到WifiScanner扫描结果AllSingleScanListener#onResults

  1. 获取Wifi候选者 mNetworkSelector.getCandidatesFromScan()
  2. 当支持STA双WIFI连接且 secondaryCmmCandidates不为空,执行handleCandidatesFromScanResultsUsingSecondaryCmmIfAvailablemActiveModeWarden.requestSecondaryLongLivedClientModeManager请求创建副WiFi类型ROLE_CLIENT_SECONDARY_LONG_LIVEDConcreteClientModeManager
  3. 最后执行 connectToNetworkUsingCmmWithoutMbb > triggerConnectToNetworkUsingCmm > clientModeManager.startConnectToNetwork() 连接网络,只有就可主Wifi连接一样,只是不同的wlan0wlan1。(Android WiFi 连接)

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1436896.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Graal编译器和GraalVM虚拟机

文章目录 说明Java程序执行流程JVM的语言无关性JVM的执行流程执行引擎的两种行为&#xff1a;解释执行和编译热点代码和热点代码探测方式热点代码热点代码探测方式热点代码探测方式流程 HotSpotVM内嵌两个JIT编译器Graal编译器GraalVMGraalVM虚拟机安装和体验GraalVM的下载和安…

【JavaEE】_传输层协议UDP与TCP

目录 1. 开发中常见的数据组织格式 1.1 XML 1.2 JSON 1.3 Protobuf 2. 端口号 3. UDP协议 4. TCP协议 4.1 特点 4.2 TCP报文格式 4.3 TCP可靠性机制 4.3.1 确认应答机制 4.3.2 超时重传机制 4.3.2.1 丢包的两种情况 4.3.2.2 重传时间 4.3.3 连接管理机制 4.3.3…

【Flink入门修炼】1-2 Mac 搭建 Flink 源码阅读环境

在后面学习 Flink 相关知识时&#xff0c;会深入源码探究其实现机制。因此&#xff0c;需要现在本地配置好源码阅读环境。 本文搭建环境&#xff1a; Mac M1&#xff08;Apple Silicon&#xff09;Java 8IDEAFlink 官方源码 一、 下载 Flink 源码 github 地址&#xff1a;h…

【Vue3+Vite】Vue生命周期与组件 快速学习 第三期

文章目录 一、Vue生命周期1.1 生命周期简介1.2 生命周期案例 二、Vue组件2.1 组件基础2.2 组件化入门案例2.3 组件之间传递数据2.3.1父传子2.3.2 子传父2.3.3 兄弟传参 总结 一、Vue生命周期 1.1 生命周期简介 每个 Vue 组件实例在创建时都需要经历一系列的初始化步骤&#xf…

UE5 获得频谱让nigara随音乐律动

参考视频:UE - Niagara实现可视化音乐动态粒子效果 案例演示及教程_哔哩哔哩_bilibili 先创建一个Niagara 在Properties的Sim Target改为GPU,Calculate Bounds Mode改为Fixed模式 生成的数量改为1000 这里的BoxSize可以选择修改,具体作用是粒子初始生成的范围 Drag,阻力,用来限…

数据结构_找环,破环题-2.5

一. 判断单链表有无环 a. 错误的思路&#xff1a;遍历陷入死循环 1&#xff09;和相交的遍历思路一样&#xff0c;找指向相同。 错误点 一直在死循环。 思考点&#xff1a;如何破环 b. 个人思路&#xff1a;反转链表回首结点 1&#xff09;目前的经验&#xff0c;无非就…

浅谈应该遵守的伦敦银交易规则

做伦敦银投资的朋友应遵守伦敦银交易规则&#xff0c;伦敦银交易规则不是指那些伦敦银交易技巧&#xff0c;而是在这个市场中要遵循的一些约定&#xff0c;下面我们就来讨论一下。 风险管理。风险管理即指投资者控制自己一笔乃至整体交易的风险&#xff0c;没有风险管理意识的投…

Vue 条件渲染 双向绑定

https://www.dedao.cn/ebook/reader?id5lZOKpMGr9mgdOvYa6Ej75XRo1NML3jx810k8ZVzb2nqPpDxBeJlK4AyQ8RPQv2z v-if实现条件渲染的功能。v-model实现双向数据传输。 v-model用来进行双向绑定&#xff0c;当输入框中的文字变化时&#xff0c;其会将变化同步到绑定的变量上&#…

【敏感词】敏感词检测功能v1.1.0版本正式上线

背景 为了解决系统发布信息时人工审核成本高的问题&#xff0c;开发一个敏感词检测系统。该系统能够自动检测用户输入的内容中是否包含敏感词&#xff0c;从而减少不合规内容的发布&#xff0c;降低人工审核成本。通过实施这个系统&#xff0c;可以提高信息发布的效率和准确性…

ArraysLambda表达式

目录 一、Arrays 1、Arrays操作数组的工具类​编辑 二、Lambda表达式 1、Lambda初体验 ​编辑 2、函数式编程 ​编辑 3、Lambda表达式的标准格式 3.1 示例代码 4、小结 ​编辑5、Lambda表达式的省略写法 ​编辑5.1 示例代码 5.2 小结 ​编辑6、Lambda表达式的练习 …

redis源码之:集群创建与节点通信(2)

在上一篇redis源码之&#xff1a;集群创建与节点通信&#xff08;1&#xff09;我们可知&#xff0c;在集群中&#xff0c;cluster节点之间&#xff0c;通过meet将对方加入到本方的cluster->nodes列表中&#xff0c;并在后续过程中&#xff0c;不断通过clusterSendPing发送p…

Jmeter 示例,格式为001-100,按顺序生成三位数的函数

1.先添加一个循环控制器&#xff0c;每次执行生成一个数, 2.添加一个beanshell Sample,编写代码,把按00X这个格式的数字&#xff0c;赋值给一个变量LoopCount // 从JMeter变量中获取当前的计数器值 String loopCountStr vars.get("LoopCount"); int loopCount (lo…

maven依赖报错处理(或者maven怎么刷新都下载不了依赖)

maven依赖报错&#xff0c;或者不报错&#xff0c;但是怎么刷新maven都没反应&#xff0c;可以试一下以下操作 当下载jar的时候&#xff0c;如果断网&#xff0c;或者连接超时的时候&#xff0c;会自动在文件夹中创建一个名为*lastupdate的文件&#xff0c;当有了这个文件之后…

代理与Reflect反射

属性描述符 Proprety Descriptor 属性描述符 用于描述一个属性的相关信息 1.Object.getOwnPropertyDescriptor(对象&#xff0c;属性名) 可以得到一个对象的 某个属性的属性描述符 Object.getOwnPropertyDescriptors(对象) 可以得到某个对象的所有属性描述符 如果需要为某个…

数据库学习笔记2024/2/4

随笔 怎么学? 1、MySQL数据库就是存储和管理数据的一个大型软件,这个软件有一个专门的语言叫SQL,主要学的是SQL语言,但想要达到企业用人标准,就还得学会熟练使用MySQL这个软件。 2、学习分三阶段: 一. 基础篇 1. MySQL概述 1.1 数据库相关概念 数据库管理系统 -> MyS…

如何修改远程端服务器密钥

前言 一段时间没改密码后&#xff0c;远程就会自动提示CtrlAltEnd键修改密码。但我电脑是笔记本&#xff0c;没有end键。打开屏幕键盘按这三个键也没用。 解决方法 打开远程 1、远程端WINC 输入osk 可以发现打开了屏幕键盘 2、电脑键盘同时按住CtrlAlt&#xff08;若自身电…

【论文+代码】ZS-N2N实现小样本零网络图像去噪

01、引言 本文方法源于Youssef Mansour和Reinhard Heckel撰写的论文《Zero-Shot Noise2Noise: Efficient Image Denoising without any Data》&#xff0c;该文作者探索了一种不需要任何数据且高效的高效图像去噪方法。 该方法使用两个固定的内核对噪声图像进行卷积&#xff…

【开源】基于JAVA+Vue+SpringBoot的快乐贩卖馆管理系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 数据中心模块2.2 搞笑视频模块2.3 视频收藏模块2.4 视频评分模块2.5 视频交易模块2.6 视频好友模块 三、系统设计3.1 用例设计3.2 数据库设计3.2.1 搞笑视频表3.2.2 视频收藏表3.2.3 视频评分表3.2.4 视频交易表 四、系…

c语言--指针运算

目录 一、指针-整数二、指针-指针2.1条件2.2两个指针指向同一块空间代码2.2.1运行结果 2.3两个指针指向不同块空间代码2.3.1运行结果 2.4总结 三、指针的关系运算3.1代码3.1.1运行结果3.1.2分析 一、指针整数 用数组举例&#xff1a; 因为数组在内存中是连续存放的&#xff0c…

C++:第十五讲高精度算法

每日C知识 system("color xx);是改变字体及背景颜色&#xff0c;前一个x代表一个数字&#xff0c;可以改变背景颜色&#xff0c;后一个x代表一个数字&#xff0c;可以改变字体颜色 &#xff0c;但都是根据颜色表来的。 记住&#xff1a;要加头文件&#xff1a;#include&l…