CINXE.COM
interview/README_en.md at master · huihut/interview · GitHub
<!DOCTYPE html> <html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system" data-a11y-link-underlines="true" > <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com"> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-7aa84bb7e11e.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-f65db3e8d171.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-a8258e3c6dda.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-7e97d834719c.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-01d869f460be.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-534f3e971240.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-a8cc7d138001.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-35e9dfdc4f9f.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-cf4cc5f62dfe.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-primitives-d9abecd14f1e.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-93aded0ee8a1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-8bed0685a4b5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-15d4b28ab680.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/repository-4fce88777fa8.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-0210be90f4d3.css" /> <script type="application/json" id="client-env">{"locale":"en","featureFlags":["a11y_quote_reply_fix","copilot_immersive_file_preview","copilot_new_references_ui","copilot_personal_instructions","copilot_personal_instructions_templates","copilot_chat_repo_custom_instructions_preview","copilot_chat_immersive_subthreading","copilot_chat_retry_on_error","copilot_chat_persist_submitted_input","copilot_conversational_ux_history_refs","copilot_chat_shared_chat_input","copilot_editor_upsells","copilot_implicit_context","copilot_no_floating_button","copilot_smell_icebreaker_ux","copilot_read_shared_conversation","dotcom_chat_client_side_skills","experimentation_azure_variant_endpoint","failbot_handle_non_errors","geojson_azure_maps","ghost_pilot_confidence_truncation_25","ghost_pilot_confidence_truncation_40","github_models_o3_mini_streaming","hide_billing_usage_filters","hovercard_accessibility","insert_before_patch","issues_advanced_search_custom_queries","issues_react_remove_placeholders","issues_react_blur_item_picker_on_close","issues_react_include_bots_in_pickers","marketing_pages_search_explore_provider","remove_child_patch","sample_network_conn_type","swp_enterprise_contact_form","site_copilot_extensions_ga","site_copilot_extensions_hero","site_copilot_vscode_link_update","site_proxima_australia_update","issues_react_create_milestone","issues_react_cache_fix_workaround","lifecycle_label_name_updates"]}</script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-bfd83850578d.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_oddbird_popover-polyfill_dist_popover_js-9da652f58479.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_arianotify-polyfill_ariaNotify-polyfill_js-node_modules_github_mi-3abb8f-d7e6bc799724.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_failbot_failbot_ts-4600dbf2d60a.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-f04cb2a9fc8c.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_index_mjs-0dbb79f97f8f.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-f690fd9ae3d5.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-f6da4b3fa34c.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-8e9f78-a74b4e0a8a6b.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_text-expander-element_dist_index_js-78748950cb0c.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-b5f1d7-a1760ffda83d.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_markdown-toolbar-element_dist_index_js-ceef33f593fa.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_primer_view-co-c44a69-8094ee2ecc5e.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-c5fd390b3ba0.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-b91e8c7aa0b9.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_braintree_browser-detection_dist_browser-detection_js-node_modules_githu-bb80ec-72267f4e3ff9.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-be8cb88f481b.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_morphdom_dist_morphdom-e-7c534c-a4a1922eb55f.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_turbo_dist_turbo_es2017-esm_js-e3cbe28f1638.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-893f9f-6cf3320416b8.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-e3180fe3bcb3.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_quote-selection_dist_index_js-node_modules_github_session-resume_-69cfcc-bc42a18e77d5.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_updatable-content_updatable-content_ts-a1563f62660e.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_task-list_ts-app_assets_modules_github_sso_ts-ui_packages-900dde-035d0557f18e.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-3e000c5d31a9.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_ajax-error_ts-app_assets_modules_github_behaviors_include-87a4ae-97019968d380.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-e429cff6ceb1.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-8ac983183615.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-f6223d90c7ba.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-01e85cd1be94.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_catalyst_lib_inde-dbbea9-26cce2010167.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-1c0aedc134b1.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/primer-react-9a5713772ca5.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/react-core-d0cc61cb9985.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/react-lib-f1bca44e0926.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/octicons-react-611691cca2f6.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_emotion_is-prop-valid_dist_emotion-is-prop-valid_esm_js-node_modules_emo-62da9f-2df2f32ec596.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_stacktrace-parser_dist_s-e7dcdd-f7cc96ebae76.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_oddbird_popover-polyfill_dist_popover-fn_js-55fea94174bf.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_dompurify_dist_purify_js-b89b98661809.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lodash-es__Stack_js-node_modules_lodash-es__Uint8Array_js-node_modules_l-4faaa6-4a736fde5c2f.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lodash-es__baseIsEqual_js-8929eb9718d5.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_hydro-analytics-client_dist_analytics-client_js-node_modules_gith-40531a-09af0ef9a562.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_aria-live_aria-live_ts-ui_packages_promise-with-resolvers-polyfill_promise-with-r-17c672-d6b5ea82572a.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_paths_index_ts-8b8414d250a8.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_ref-selector_RefSelector_tsx-7496afc3784d.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_diffs_diff-parts_ts-555a13945c12.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_code-view-shared_worker-jobs_debounced-worker-manager_ts-ui_packages_commit-attri-a6ddb4-2f798a8060e9.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_code-view-shared_hooks_use-canonical-object_ts-ui_packages_code-view-shared_hooks-a6859a-51fe787d3cdc.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_repos-file-tree-view_repos-file-tree-view_ts-ui_packages_feature-request_FeatureR-648c3b-ad58d952149e.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_blob-anchor_ts-ui_packages_code-nav_code-nav_ts-ui_packages_filter--8253c1-91468a3354f9.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/react-code-view-56d3e189774d.js"></script> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.2b41f48ec06f29182cb4.module.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/react-code-view.ab7d8fac328c00e5e0cc.module.css" /> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-subscriptions-menu-4a07d5e6bdd6.js"></script> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.2b41f48ec06f29182cb4.module.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/notifications-subscriptions-menu.1bcff9205c241e99cff2.module.css" /> <title>interview/README_en.md at master · huihut/interview · GitHub</title> <meta name="route-pattern" content="/:user_id/:repository/blob/*name(/*path)" data-turbo-transient> <meta name="route-controller" content="blob" data-turbo-transient> <meta name="route-action" content="show" data-turbo-transient> <meta name="current-catalog-service-hash" content="f3abb0cc802f3d7b95fc8762b94bdcb13bf39634c40c357301c4aa1d67a256fb"> <meta name="request-id" content="CC58:295301:FF3644:12B5883:67BF05F1" data-pjax-transient="true"/><meta name="html-safe-nonce" content="630a837794f226c644c22e4b029367ff91211b8c6d059ad1736e121f472a7aa3" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzU4OjI5NTMwMTpGRjM2NDQ6MTJCNTg4Mzo2N0JGMDVGMSIsInZpc2l0b3JfaWQiOiI1MDkwOTc1Nzc0NTA5MzAzMjgxIiwicmVnaW9uX2VkZ2UiOiJzb3V0aGVhc3Rhc2lhIiwicmVnaW9uX3JlbmRlciI6InNvdXRoZWFzdGFzaWEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="4f63fb7166adc9d5e8bcf98335e2476fd3ad16725123d7e8b23efd41c89b09ee" data-pjax-transient="true"/> <meta name="hovercard-subject-tag" content="repository:120887835" data-turbo-transient> <meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree,copilot" data-turbo-transient="true" /> <meta name="selected-link" value="repo_source" data-turbo-transient> <link rel="assets" href="https://github.githubassets.com/"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I"> <meta name="octolytics-url" content="https://collector.github.com/github/collect" /> <meta name="analytics-location" content="/<user-name>/<repo-name>/blob/show" data-turbo-transient="true" /> <meta name="user-login" content=""> <meta name="viewport" content="width=device-width"> <meta name="description" content="📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, including language, program library, data structure, algorithm, system, network, link loading library, interview experience, recruitment, recommendation, etc. - interview/README_en.md at master · huihut/interview"> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905, app-argument=https://github.com/huihut/interview/blob/master/README_en.md" /> <meta name="twitter:image" content="https://opengraph.githubassets.com/022e79b4dd4b681a6be902dd8e8f53f7dbf89788a9eb14da1cb5b975b468e635/huihut/interview" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="interview/README_en.md at master · huihut/interview" /><meta name="twitter:description" content="📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, in..." /> <meta property="og:image" content="https://opengraph.githubassets.com/022e79b4dd4b681a6be902dd8e8f53f7dbf89788a9eb14da1cb5b975b468e635/huihut/interview" /><meta property="og:image:alt" content="📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, in..." /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="interview/README_en.md at master · huihut/interview" /><meta property="og:url" content="https://github.com/huihut/interview/blob/master/README_en.md" /><meta property="og:description" content="📚 C/C++ 技术面试基础知识总结,包括语言、程序库、数据结构、算法、系统、网络、链接装载库等知识及面试经验、招聘、内推等信息。This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C/C++ technology, in..." /> <meta name="hostname" content="github.com"> <meta name="expected-hostname" content="github.com"> <meta http-equiv="x-pjax-version" content="b1da3bd173c12d056d260a68c916b216e9e30e3c647c21bc2ecf97c2b4bed25f" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="ace39c3b6632770952207593607e6e0be0db363435a8b877b1f96abe6430f345" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="249d206a8cd18f10036cb45c470746438fc2c46dae40dbaa0f80bb8c4539b047" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="5bfa2102fa5ed48fab16ab8999fb76d265c6640dfb8240ffc8fbcb673f7ab0ee" data-turbo-track="reload"> <meta name="turbo-cache-control" content="no-preview" data-turbo-transient=""> <meta name="turbo-cache-control" content="no-cache" data-turbo-transient> <meta data-hydrostats="publish"> <meta name="go-import" content="github.com/huihut/interview git https://github.com/huihut/interview.git"> <meta name="octolytics-dimension-user_id" content="23519480" /><meta name="octolytics-dimension-user_login" content="huihut" /><meta name="octolytics-dimension-repository_id" content="120887835" /><meta name="octolytics-dimension-repository_nwo" content="huihut/interview" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="120887835" /><meta name="octolytics-dimension-repository_network_root_nwo" content="huihut/interview" /> <meta name="turbo-body-classes" content="logged-out env-production page-responsive"> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <link rel="mask-icon" href="https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg" data-base-href="https://github.githubassets.com/favicons/favicon"> <meta name="theme-color" content="#1e2327"> <meta name="color-scheme" content="light dark" /> <link rel="manifest" href="/manifest.json" crossOrigin="use-credentials"> </head> <body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div class="position-relative header-wrapper js-header-wrapper "> <a href="#start-of-content" data-skip-target-assigned="false" class="px-2 py-4 color-bg-accent-emphasis color-fg-on-emphasis show-on-focus js-skip-to-content">Skip to content</a> <span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full"> <span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis"></span> </span> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_ui-commands_ui-commands_ts-97496b0f52ba.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/keyboard-shortcuts-dialog-c79a97a16b04.js"></script> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-react.2b41f48ec06f29182cb4.module.css" /> <react-partial partial-name="keyboard-shortcuts-dialog" data-ssr="false" data-attempted-ssr="false" > <script type="application/json" data-target="react-partial.embeddedData">{"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}</script> <div data-target="react-partial.reactRoot"></div> </react-partial> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-56e2d9924e94.js"></script> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-730dca81d0a2.js"></script> <header class="HeaderMktg header-logged-out js-details-container js-header Details f4 py-3" role="banner" data-is-top="true" data-color-mode=light data-light-theme=light data-dark-theme=dark> <h2 class="sr-only">Navigation Menu</h2> <button type="button" class="HeaderMktg-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span class="d-none">Toggle navigation</span> </button> <div class="d-flex flex-column flex-lg-row flex-items-center px-3 px-md-4 px-lg-5 height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <div class="flex-1"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target js-nav-padding-recalculate js-header-menu-toggle Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span class="Button-content"> <span class="Button-label"><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span> </button> </div> <a class="mr-lg-3 color-fg-inherit flex-order-2 js-prevent-focus-on-mobile-nav" href="/" aria-label="Homepage" data-analytics-event="{"category":"Marketing nav","action":"click to go to homepage","label":"ref_page:Marketing;ref_cta:Logomark;ref_loc:Header"}"> <svg height="32" aria-hidden="true" viewBox="0 0 24 24" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M12.5.75C6.146.75 1 5.896 1 12.25c0 5.089 3.292 9.387 7.863 10.91.575.101.79-.244.79-.546 0-.273-.014-1.178-.014-2.142-2.889.532-3.636-.704-3.866-1.35-.13-.331-.69-1.352-1.18-1.625-.402-.216-.977-.748-.014-.762.906-.014 1.553.834 1.769 1.179 1.035 1.74 2.688 1.25 3.349.948.1-.747.402-1.25.733-1.538-2.559-.287-5.232-1.279-5.232-5.678 0-1.25.445-2.285 1.178-3.09-.115-.288-.517-1.467.115-3.048 0 0 .963-.302 3.163 1.179.92-.259 1.897-.388 2.875-.388.977 0 1.955.13 2.875.388 2.2-1.495 3.162-1.179 3.162-1.179.633 1.581.23 2.76.115 3.048.733.805 1.179 1.825 1.179 3.09 0 4.413-2.688 5.39-5.247 5.678.417.36.776 1.05.776 2.128 0 1.538-.014 2.774-.014 3.162 0 .302.216.662.79.547C20.709 21.637 24 17.324 24 12.25 24 5.896 18.854.75 12.5.75Z"></path> </svg> </a> <div class="flex-1 flex-order-2 text-right"> <a href="/login?return_to=https%3A%2F%2Fgithub.com%2Fhuihut%2Finterview%2Fblob%2Fmaster%2FREADME_en.md" class="HeaderMenu-link HeaderMenu-button d-inline-flex d-lg-none flex-order-1 f5 no-underline border color-border-default rounded-2 px-2 py-1 color-fg-inherit js-prevent-focus-on-mobile-nav" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://github.com/huihut/interview/blob/master/README_en.md","user_id":null}}" data-hydro-click-hmac="b94661aff3a4ed9fb1aba09ac8a24820f61ef244a141c8eff031fa2251141f5d" data-analytics-event="{"category":"Marketing nav","action":"click to Sign in","label":"ref_page:Marketing;ref_cta:Sign in;ref_loc:Header"}" > Sign in </a> </div> </div> <div class="HeaderMenu js-header-menu height-fit position-lg-relative d-lg-flex flex-column flex-auto top-0"> <div class="HeaderMenu-wrapper d-flex flex-column flex-self-start flex-lg-row flex-auto rounded rounded-lg-0"> <nav class="HeaderMenu-nav" aria-label="Global"> <ul class="d-lg-flex list-style-none"> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 d-lg-flex flex-wrap dropdown-menu-wide"> <div class="HeaderMenu-column px-lg-4 border-lg-right mb-4 mb-lg-0 pr-lg-7"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"github_copilot","context":"product","tag":"link","label":"github_copilot_link_product_navbar"}" href="https://github.com/features/copilot"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"></path><path d="M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"></path> </svg> <div> <div class="color-fg-default h4">GitHub Copilot</div> Write better code with AI </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"security","context":"product","tag":"link","label":"security_link_product_navbar"}" href="https://github.com/features/security"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path> </svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"actions","context":"product","tag":"link","label":"actions_link_product_navbar"}" href="https://github.com/features/actions"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path> </svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"codespaces","context":"product","tag":"link","label":"codespaces_link_product_navbar"}" href="https://github.com/features/codespaces"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path> </svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"issues","context":"product","tag":"link","label":"issues_link_product_navbar"}" href="https://github.com/features/issues"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path> </svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"code_review","context":"product","tag":"link","label":"code_review_link_product_navbar"}" href="https://github.com/features/code-review"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path> </svg> <div> <div class="color-fg-default h4">Code Review</div> Manage code changes </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"discussions","context":"product","tag":"link","label":"discussions_link_product_navbar"}" href="https://github.com/features/discussions"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path> </svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"code_search","context":"product","tag":"link","label":"code_search_link_product_navbar"}" href="https://github.com/features/code-search"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-square color-fg-subtle mr-3"> <path d="M10.3 8.24a.75.75 0 0 1-.04 1.06L7.352 12l2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M2 3.75C2 2.784 2.784 2 3.75 2h16.5c.966 0 1.75.784 1.75 1.75v16.5A1.75 1.75 0 0 1 20.25 22H3.75A1.75 1.75 0 0 1 2 20.25Zm1.75-.25a.25.25 0 0 0-.25.25v16.5c0 .138.112.25.25.25h16.5a.25.25 0 0 0 .25-.25V3.75a.25.25 0 0 0-.25-.25Z"></path> </svg> <div> <div class="color-fg-default h4">Code Search</div> Find more, search less </div> </a></li> </ul> </div> </div> <div class="HeaderMenu-column px-lg-4"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="product-explore-heading">Explore</span> <ul class="list-style-none f5" aria-labelledby="product-explore-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"all_features","context":"product","tag":"link","label":"all_features_link_product_navbar"}" href="https://github.com/features"> All features </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"documentation","context":"product","tag":"link","label":"documentation_link_product_navbar"}" href="https://docs.github.com"> Documentation <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"github_skills","context":"product","tag":"link","label":"github_skills_link_product_navbar"}" href="https://skills.github.com"> GitHub Skills <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"blog","context":"product","tag":"link","label":"blog_link_product_navbar"}" href="https://github.blog"> Blog <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex flex-wrap dropdown-menu-wide"> <div class="HeaderMenu-column px-lg-4 border-lg-right mb-4 mb-lg-0 pr-lg-7"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 pb-lg-3 mb-3 mb-lg-0"> <span class="d-block h4 color-fg-default my-1" id="solutions-by-company-size-heading">By company size</span> <ul class="list-style-none f5" aria-labelledby="solutions-by-company-size-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"enterprises","context":"solutions","tag":"link","label":"enterprises_link_solutions_navbar"}" href="https://github.com/enterprise"> Enterprises </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"small_and_medium_teams","context":"solutions","tag":"link","label":"small_and_medium_teams_link_solutions_navbar"}" href="https://github.com/team"> Small and medium teams </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"startups","context":"solutions","tag":"link","label":"startups_link_solutions_navbar"}" href="https://github.com/enterprise/startups"> Startups </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"nonprofits","context":"solutions","tag":"link","label":"nonprofits_link_solutions_navbar"}" href="/solutions/industry/nonprofits"> Nonprofits </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="solutions-by-use-case-heading">By use case</span> <ul class="list-style-none f5" aria-labelledby="solutions-by-use-case-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"devsecops","context":"solutions","tag":"link","label":"devsecops_link_solutions_navbar"}" href="/solutions/use-case/devsecops"> DevSecOps </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"devops","context":"solutions","tag":"link","label":"devops_link_solutions_navbar"}" href="/solutions/use-case/devops"> DevOps </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"ci_cd","context":"solutions","tag":"link","label":"ci_cd_link_solutions_navbar"}" href="/solutions/use-case/ci-cd"> CI/CD </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"view_all_use_cases","context":"solutions","tag":"link","label":"view_all_use_cases_link_solutions_navbar"}" href="/solutions/use-case"> View all use cases </a></li> </ul> </div> </div> <div class="HeaderMenu-column px-lg-4"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="solutions-by-industry-heading">By industry</span> <ul class="list-style-none f5" aria-labelledby="solutions-by-industry-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"healthcare","context":"solutions","tag":"link","label":"healthcare_link_solutions_navbar"}" href="/solutions/industry/healthcare"> Healthcare </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"financial_services","context":"solutions","tag":"link","label":"financial_services_link_solutions_navbar"}" href="/solutions/industry/financial-services"> Financial services </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"manufacturing","context":"solutions","tag":"link","label":"manufacturing_link_solutions_navbar"}" href="/solutions/industry/manufacturing"> Manufacturing </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"government","context":"solutions","tag":"link","label":"government_link_solutions_navbar"}" href="/solutions/industry/government"> Government </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"view_all_industries","context":"solutions","tag":"link","label":"view_all_industries_link_solutions_navbar"}" href="/solutions/industry"> View all industries </a></li> </ul> </div> </div> <div class="HeaderMenu-trailing-link rounded-bottom-2 flex-shrink-0 mt-lg-4 px-lg-4 py-4 py-lg-3 f5 text-semibold"> <a href="/solutions"> View all solutions <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-right HeaderMenu-trailing-link-icon"> <path d="M6.22 3.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L9.94 8 6.22 4.28a.75.75 0 0 1 0-1.06Z"></path> </svg> </a> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Resources <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 d-lg-flex flex-wrap dropdown-menu-wide"> <div class="HeaderMenu-column px-lg-4 border-lg-right mb-4 mb-lg-0 pr-lg-7"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="resources-topics-heading">Topics</span> <ul class="list-style-none f5" aria-labelledby="resources-topics-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"ai","context":"resources","tag":"link","label":"ai_link_resources_navbar"}" href="/resources/articles/ai"> AI </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"devops","context":"resources","tag":"link","label":"devops_link_resources_navbar"}" href="/resources/articles/devops"> DevOps </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"security","context":"resources","tag":"link","label":"security_link_resources_navbar"}" href="/resources/articles/security"> Security </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"software_development","context":"resources","tag":"link","label":"software_development_link_resources_navbar"}" href="/resources/articles/software-development"> Software Development </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"view_all","context":"resources","tag":"link","label":"view_all_link_resources_navbar"}" href="/resources/articles"> View all </a></li> </ul> </div> </div> <div class="HeaderMenu-column px-lg-4"> <div class="border-bottom pb-3 pb-lg-0 border-lg-bottom-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="resources-explore-heading">Explore</span> <ul class="list-style-none f5" aria-labelledby="resources-explore-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"learning_pathways","context":"resources","tag":"link","label":"learning_pathways_link_resources_navbar"}" href="https://resources.github.com/learn/pathways"> Learning Pathways <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"events_amp_webinars","context":"resources","tag":"link","label":"events_amp_webinars_link_resources_navbar"}" href="https://resources.github.com"> Events & Webinars <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"ebooks_amp_whitepapers","context":"resources","tag":"link","label":"ebooks_amp_whitepapers_link_resources_navbar"}" href="https://github.com/resources/whitepapers"> Ebooks & Whitepapers </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"customer_stories","context":"resources","tag":"link","label":"customer_stories_link_resources_navbar"}" href="https://github.com/customer-stories"> Customer Stories </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary Link--external" target="_blank" data-analytics-event="{"location":"navbar","action":"partners","context":"resources","tag":"link","label":"partners_link_resources_navbar"}" href="https://partner.github.com"> Partners <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path> </svg> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"executive_insights","context":"resources","tag":"link","label":"executive_insights_link_resources_navbar"}" href="https://github.com/solutions/executive-insights"> Executive Insights </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 px-lg-4"> <div class="HeaderMenu-column"> <div class="border-bottom pb-3 pb-lg-0 pb-lg-3 mb-3 mb-lg-0 mb-lg-3"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"github_sponsors","context":"open_source","tag":"link","label":"github_sponsors_link_open_source_navbar"}" href="/sponsors"> <div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div> </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 pb-lg-3 mb-3 mb-lg-0 mb-lg-3"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"the_readme_project","context":"open_source","tag":"link","label":"the_readme_project_link_open_source_navbar"}" href="https://github.com/readme"> <div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div> </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="open-source-repositories-heading">Repositories</span> <ul class="list-style-none f5" aria-labelledby="open-source-repositories-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"topics","context":"open_source","tag":"link","label":"topics_link_open_source_navbar"}" href="https://github.com/topics"> Topics </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"trending","context":"open_source","tag":"link","label":"trending_link_open_source_navbar"}" href="https://github.com/trending"> Trending </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary" data-analytics-event="{"location":"navbar","action":"collections","context":"open_source","tag":"link","label":"collections_link_open_source_navbar"}" href="https://github.com/collections"> Collections </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Enterprise <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path> </svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 pt-2 pt-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 pb-2 pb-lg-4 px-lg-4"> <div class="HeaderMenu-column"> <div class="border-bottom pb-3 pb-lg-0 pb-lg-3 mb-3 mb-lg-0 mb-lg-3"> <ul class="list-style-none f5" > <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"enterprise_platform","context":"enterprise","tag":"link","label":"enterprise_platform_link_enterprise_navbar"}" href="/enterprise"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-stack color-fg-subtle mr-3"> <path d="M11.063 1.456a1.749 1.749 0 0 1 1.874 0l8.383 5.316a1.751 1.751 0 0 1 0 2.956l-8.383 5.316a1.749 1.749 0 0 1-1.874 0L2.68 9.728a1.751 1.751 0 0 1 0-2.956Zm1.071 1.267a.25.25 0 0 0-.268 0L3.483 8.039a.25.25 0 0 0 0 .422l8.383 5.316a.25.25 0 0 0 .268 0l8.383-5.316a.25.25 0 0 0 0-.422Z"></path><path d="M1.867 12.324a.75.75 0 0 1 1.035-.232l8.964 5.685a.25.25 0 0 0 .268 0l8.964-5.685a.75.75 0 0 1 .804 1.267l-8.965 5.685a1.749 1.749 0 0 1-1.874 0l-8.965-5.685a.75.75 0 0 1-.231-1.035Z"></path><path d="M1.867 16.324a.75.75 0 0 1 1.035-.232l8.964 5.685a.25.25 0 0 0 .268 0l8.964-5.685a.75.75 0 0 1 .804 1.267l-8.965 5.685a1.749 1.749 0 0 1-1.874 0l-8.965-5.685a.75.75 0 0 1-.231-1.035Z"></path> </svg> <div> <div class="color-fg-default h4">Enterprise platform</div> AI-powered developer platform </div> </a></li> </ul> </div> <div class="border-bottom pb-3 pb-lg-0 border-bottom-0"> <span class="d-block h4 color-fg-default my-1" id="enterprise-available-add-ons-heading">Available add-ons</span> <ul class="list-style-none f5" aria-labelledby="enterprise-available-add-ons-heading"> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"advanced_security","context":"enterprise","tag":"link","label":"advanced_security_link_enterprise_navbar"}" href="https://github.com/enterprise/advanced-security"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path> </svg> <div> <div class="color-fg-default h4">Advanced Security</div> Enterprise-grade security features </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description pb-lg-3" data-analytics-event="{"location":"navbar","action":"github_copilot","context":"enterprise","tag":"link","label":"github_copilot_link_enterprise_navbar"}" href="/features/copilot#enterprise"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"></path><path d="M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"></path> </svg> <div> <div class="color-fg-default h4">GitHub Copilot</div> Enterprise-grade AI features </div> </a></li> <li> <a class="HeaderMenu-dropdown-link d-block no-underline position-relative py-2 Link--secondary d-flex flex-items-center Link--has-description" data-analytics-event="{"location":"navbar","action":"premium_support","context":"enterprise","tag":"link","label":"premium_support_link_enterprise_navbar"}" href="/premium-support"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path> </svg> <div> <div class="color-fg-default h4">Premium Support</div> Enterprise-grade 24/7 support </div> </a></li> </ul> </div> </div> </div> </li> <li class="HeaderMenu-item position-relative flex-wrap flex-justify-between flex-items-center d-block d-lg-flex flex-lg-nowrap flex-lg-items-center js-details-container js-header-menu-item"> <a class="HeaderMenu-link no-underline px-0 px-lg-2 py-3 py-lg-2 d-block d-lg-inline-block" data-analytics-event="{"location":"navbar","action":"pricing","context":"global","tag":"link","label":"pricing_link_global_navbar"}" href="https://github.com/pricing">Pricing</a> </li> </ul> </nav> <div class="d-flex flex-column flex-lg-row width-full flex-justify-end flex-lg-items-center text-center mt-3 mt-lg-0 text-lg-left ml-lg-3"> <qbsearch-input class="search-input" data-scope="repo:huihut/interview" data-custom-scopes-path="/search/custom_scopes" data-delete-custom-scopes-csrf="KpcfRIdKwZBuO6JAZrMQUAHYiq_I9CqfO-b4FyYVBjus7GGJTPFZBy8KL7e1bGqLAGhOOUzH5ljERf7gnerwdA" data-max-custom-scopes="10" data-header-redesign-enabled="false" data-initial-value="" data-blackbird-suggestions-path="/search/suggestions" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" data-current-repository="huihut/interview" data-current-org="" data-current-owner="huihut" data-logged-in="false" data-copilot-chat-enabled="false" data-nl-search-enabled="false" data-retain-scroll-position="true"> <div class="search-input-container search-with-dialog position-relative d-flex flex-row flex-items-center mr-4 rounded" data-action="click:qbsearch-input#searchInputContainerClicked" > <button type="button" class="header-search-button placeholder input-button form-control d-flex flex-1 flex-self-stretch flex-items-center no-wrap width-full py-0 pl-2 pr-0 text-left border-0 box-shadow-none" data-target="qbsearch-input.inputButton" aria-label="Search or jump to…" aria-haspopup="dialog" placeholder="Search or jump to..." data-hotkey=s,/ autocapitalize="off" data-analytics-event="{"location":"navbar","action":"searchbar","context":"global","tag":"input","label":"searchbar_input_global_navbar"}" data-action="click:qbsearch-input#handleExpand" > <div class="mr-2 color-fg-muted"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path> </svg> </div> <span class="flex-1" data-target="qbsearch-input.inputButtonText">Search or jump to...</span> <div class="d-flex" data-target="qbsearch-input.hotkeyIndicator"> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg> </div> </button> <input type="hidden" name="type" class="js-site-search-type-field"> <div class="Overlay--hidden " data-modal-dialog-overlay> <modal-dialog data-action="close:qbsearch-input#handleClose cancel:qbsearch-input#handleClose" data-target="qbsearch-input.searchSuggestionsDialog" role="dialog" id="search-suggestions-dialog" aria-modal="true" aria-labelledby="search-suggestions-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto"> <h1 id="search-suggestions-dialog-header" class="sr-only">Search code, repositories, users, issues, pull requests...</h1> <div class="Overlay-body Overlay-body--paddingNone"> <div data-view-component="true"> <div class="search-suggestions position-fixed width-full color-shadow-large border color-fg-default color-bg-default overflow-hidden d-flex flex-column query-builder-container" style="border-radius: 12px;" data-target="qbsearch-input.queryBuilderContainer" hidden > <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="query-builder-test-form" action="" accept-charset="UTF-8" method="get"> <query-builder data-target="qbsearch-input.queryBuilder" id="query-builder-query-builder-test" data-filter-key=":" data-view-component="true" class="QueryBuilder search-query-builder"> <div class="FormControl FormControl--fullWidth"> <label id="query-builder-test-label" for="query-builder-test" class="FormControl-label sr-only"> Search </label> <div class="QueryBuilder-StyledInput width-fit " data-target="query-builder.styledInput" > <span id="query-builder-test-leadingvisual-wrap" class="FormControl-input-leadingVisualWrap QueryBuilder-leadingVisualWrap"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search FormControl-input-leadingVisual"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path> </svg> </span> <div data-target="query-builder.styledInputContainer" class="QueryBuilder-StyledInputContainer"> <div aria-hidden="true" class="QueryBuilder-StyledInputContent" data-target="query-builder.styledInputContent" ></div> <div class="QueryBuilder-InputWrapper"> <div aria-hidden="true" class="QueryBuilder-Sizer" data-target="query-builder.sizer"></div> <input id="query-builder-test" name="query-builder-test" value="" autocomplete="off" type="text" role="combobox" spellcheck="false" aria-expanded="false" aria-describedby="validation-2804db65-75ba-47b1-af96-9dd28feb7013" data-target="query-builder.input" data-action=" input:query-builder#inputChange blur:query-builder#inputBlur keydown:query-builder#inputKeydown focus:query-builder#inputFocus " data-view-component="true" class="FormControl-input QueryBuilder-Input FormControl-medium" /> </div> </div> <span class="sr-only" id="query-builder-test-clear">Clear</span> <button role="button" id="query-builder-test-clear-button" aria-labelledby="query-builder-test-clear query-builder-test-label" data-target="query-builder.clearButton" data-action=" click:query-builder#clear focus:query-builder#clearButtonFocus blur:query-builder#clearButtonBlur " variant="small" hidden="hidden" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium mr-1 px-2 py-0 d-flex flex-items-center rounded-1 color-fg-muted"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x-circle-fill Button-visual"> <path d="M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.751.751 0 0 0-1.042.018.751.751 0 0 0-.018 1.042L6.94 8 4.97 9.97a.749.749 0 0 0 .326 1.275.749.749 0 0 0 .734-.215L8 9.06l1.97 1.97a.749.749 0 0 0 1.275-.326.749.749 0 0 0-.215-.734L9.06 8l1.97-1.97a.749.749 0 0 0-.326-1.275.749.749 0 0 0-.734.215L8 6.94Z"></path> </svg> </button> </div> <template id="search-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path> </svg> </template> <template id="code-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path> </svg> </template> <template id="file-code-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file-code"> <path d="M4 1.75C4 .784 4.784 0 5.75 0h5.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v8.586A1.75 1.75 0 0 1 14.25 15h-9a.75.75 0 0 1 0-1.5h9a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 10 4.25V1.5H5.75a.25.25 0 0 0-.25.25v2.5a.75.75 0 0 1-1.5 0Zm1.72 4.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.47-1.47-1.47-1.47a.75.75 0 0 1 0-1.06ZM3.28 7.78 1.81 9.25l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Zm8.22-6.218V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path> </svg> </template> <template id="history-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path> </svg> </template> <template id="repo-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path> </svg> </template> <template id="bookmark-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bookmark"> <path d="M3 2.75C3 1.784 3.784 1 4.75 1h6.5c.966 0 1.75.784 1.75 1.75v11.5a.75.75 0 0 1-1.227.579L8 11.722l-3.773 3.107A.751.751 0 0 1 3 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.91l3.023-2.489a.75.75 0 0 1 .954 0l3.023 2.49V2.75a.25.25 0 0 0-.25-.25Z"></path> </svg> </template> <template id="plus-circle-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-plus-circle"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm7.25-3.25v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5a.75.75 0 0 1 1.5 0Z"></path> </svg> </template> <template id="circle-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-dot-fill"> <path d="M8 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"></path> </svg> </template> <template id="trash-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-trash"> <path d="M11 1.75V3h2.25a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1 0-1.5H5V1.75C5 .784 5.784 0 6.75 0h2.5C10.216 0 11 .784 11 1.75ZM4.496 6.675l.66 6.6a.25.25 0 0 0 .249.225h5.19a.25.25 0 0 0 .249-.225l.66-6.6a.75.75 0 0 1 1.492.149l-.66 6.6A1.748 1.748 0 0 1 10.595 15h-5.19a1.75 1.75 0 0 1-1.741-1.575l-.66-6.6a.75.75 0 1 1 1.492-.15ZM6.5 1.75V3h3V1.75a.25.25 0 0 0-.25-.25h-2.5a.25.25 0 0 0-.25.25Z"></path> </svg> </template> <template id="team-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-people"> <path d="M2 5.5a3.5 3.5 0 1 1 5.898 2.549 5.508 5.508 0 0 1 3.034 4.084.75.75 0 1 1-1.482.235 4 4 0 0 0-7.9 0 .75.75 0 0 1-1.482-.236A5.507 5.507 0 0 1 3.102 8.05 3.493 3.493 0 0 1 2 5.5ZM11 4a3.001 3.001 0 0 1 2.22 5.018 5.01 5.01 0 0 1 2.56 3.012.749.749 0 0 1-.885.954.752.752 0 0 1-.549-.514 3.507 3.507 0 0 0-2.522-2.372.75.75 0 0 1-.574-.73v-.352a.75.75 0 0 1 .416-.672A1.5 1.5 0 0 0 11 5.5.75.75 0 0 1 11 4Zm-5.5-.5a2 2 0 1 0-.001 3.999A2 2 0 0 0 5.5 3.5Z"></path> </svg> </template> <template id="project-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path> </svg> </template> <template id="pencil-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-pencil"> <path d="M11.013 1.427a1.75 1.75 0 0 1 2.474 0l1.086 1.086a1.75 1.75 0 0 1 0 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 0 1-.927-.928l.929-3.25c.081-.286.235-.547.445-.758l8.61-8.61Zm.176 4.823L9.75 4.81l-6.286 6.287a.253.253 0 0 0-.064.108l-.558 1.953 1.953-.558a.253.253 0 0 0 .108-.064Zm1.238-3.763a.25.25 0 0 0-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 0 0 0-.354Z"></path> </svg> </template> <template id="copilot-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copilot"> <path d="M7.998 15.035c-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.201-.508-.254-1.084-.254-1.656 0-.87.128-1.769.693-2.484.579-.733 1.494-1.124 2.724-1.261 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095v1.872c0 .766-3.351 3.795-8.002 3.795Zm0-1.485c2.28 0 4.584-1.11 5.002-1.433V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-1.146 0-2.059-.327-2.71-.991A3.222 3.222 0 0 1 8 6.303a3.24 3.24 0 0 1-.544.743c-.65.664-1.563.991-2.71.991-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433ZM6.762 2.83c-.193-.206-.637-.413-1.682-.297-1.019.113-1.479.404-1.713.7-.247.312-.369.789-.369 1.554 0 .793.129 1.171.308 1.371.162.181.519.379 1.442.379.853 0 1.339-.235 1.638-.54.315-.322.527-.827.617-1.553.117-.935-.037-1.395-.241-1.614Zm4.155-.297c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Z"></path><path d="M6.25 9.037a.75.75 0 0 1 .75.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 .75-.75Zm4.25.75v1.501a.75.75 0 0 1-1.5 0V9.787a.75.75 0 0 1 1.5 0Z"></path> </svg> </template> <template id="copilot-error-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copilot-error"> <path d="M16 11.24c0 .112-.072.274-.21.467L13 9.688V7.862l-.023-.116c-.49.21-1.075.291-1.727.291-.198 0-.388-.009-.571-.029L6.833 5.226a4.01 4.01 0 0 0 .17-.782c.117-.935-.037-1.395-.241-1.614-.193-.206-.637-.413-1.682-.297-.683.076-1.115.231-1.395.415l-1.257-.91c.579-.564 1.413-.877 2.485-.996 1.206-.134 2.262.034 2.944.765.05.053.096.108.139.165.044-.057.094-.112.143-.165.682-.731 1.738-.899 2.944-.765 1.23.137 2.145.528 2.724 1.261.566.715.693 1.614.693 2.484 0 .572-.053 1.148-.254 1.656.066.228.098.429.126.612.012.076.024.148.037.218.924.385 1.522 1.471 1.591 2.095Zm-5.083-8.707c-1.044-.116-1.488.091-1.681.297-.204.219-.359.679-.242 1.614.091.726.303 1.231.618 1.553.299.305.784.54 1.638.54.922 0 1.28-.198 1.442-.379.179-.2.308-.578.308-1.371 0-.765-.123-1.242-.37-1.554-.233-.296-.693-.587-1.713-.7Zm2.511 11.074c-1.393.776-3.272 1.428-5.43 1.428-4.562 0-7.873-2.914-7.998-3.749V9.338c.085-.628.677-1.686 1.588-2.065.013-.07.024-.143.036-.218.029-.183.06-.384.126-.612-.18-.455-.241-.963-.252-1.475L.31 4.107A.747.747 0 0 1 0 3.509V3.49a.748.748 0 0 1 .625-.73c.156-.026.306.047.435.139l14.667 10.578a.592.592 0 0 1 .227.264.752.752 0 0 1 .046.249v.022a.75.75 0 0 1-1.19.596Zm-1.367-.991L5.635 7.964a5.128 5.128 0 0 1-.889.073c-.652 0-1.236-.081-1.727-.291l-.023.116v4.255c.419.323 2.722 1.433 5.002 1.433 1.539 0 3.089-.505 4.063-.934Z"></path> </svg> </template> <template id="workflow-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-workflow"> <path d="M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"></path> </svg> </template> <template id="book-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-book"> <path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"></path> </svg> </template> <template id="code-review-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code-review"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 13H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25v-8.5C0 1.784.784 1 1.75 1ZM1.5 2.75v8.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-8.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Zm5.28 1.72a.75.75 0 0 1 0 1.06L5.31 7l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.75.75 0 0 1 1.06 0Zm2.44 0a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L10.69 7 9.22 5.53a.75.75 0 0 1 0-1.06Z"></path> </svg> </template> <template id="codespaces-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-codespaces"> <path d="M0 11.25c0-.966.784-1.75 1.75-1.75h12.5c.966 0 1.75.784 1.75 1.75v3A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm2-9.5C2 .784 2.784 0 3.75 0h8.5C13.216 0 14 .784 14 1.75v5a1.75 1.75 0 0 1-1.75 1.75h-8.5A1.75 1.75 0 0 1 2 6.75Zm1.75-.25a.25.25 0 0 0-.25.25v5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5a.25.25 0 0 0-.25-.25Zm-2 9.5a.25.25 0 0 0-.25.25v3c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-3a.25.25 0 0 0-.25-.25Z"></path><path d="M7 12.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path> </svg> </template> <template id="comment-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-comment"> <path d="M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path> </svg> </template> <template id="comment-discussion-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-comment-discussion"> <path d="M1.75 1h8.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 10.25 10H7.061l-2.574 2.573A1.458 1.458 0 0 1 2 11.543V10h-.25A1.75 1.75 0 0 1 0 8.25v-5.5C0 1.784.784 1 1.75 1ZM1.5 2.75v5.5c0 .138.112.25.25.25h1a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h3.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm13 2a.25.25 0 0 0-.25-.25h-.5a.75.75 0 0 1 0-1.5h.5c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 14.25 12H14v1.543a1.458 1.458 0 0 1-2.487 1.03L9.22 12.28a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l2.22 2.22v-2.19a.75.75 0 0 1 .75-.75h1a.25.25 0 0 0 .25-.25Z"></path> </svg> </template> <template id="organization-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-organization"> <path d="M1.75 16A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0h8.5C11.216 0 12 .784 12 1.75v12.5c0 .085-.006.168-.018.25h2.268a.25.25 0 0 0 .25-.25V8.285a.25.25 0 0 0-.111-.208l-1.055-.703a.749.749 0 1 1 .832-1.248l1.055.703c.487.325.779.871.779 1.456v5.965A1.75 1.75 0 0 1 14.25 16h-3.5a.766.766 0 0 1-.197-.026c-.099.017-.2.026-.303.026h-3a.75.75 0 0 1-.75-.75V14h-1v1.25a.75.75 0 0 1-.75.75Zm-.25-1.75c0 .138.112.25.25.25H4v-1.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 .75.75v1.25h2.25a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25ZM3.75 6h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5ZM3 3.75A.75.75 0 0 1 3.75 3h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 3 3.75Zm4 3A.75.75 0 0 1 7.75 6h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 7 6.75ZM7.75 3h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5ZM3 9.75A.75.75 0 0 1 3.75 9h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 3 9.75ZM7.75 9h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5Z"></path> </svg> </template> <template id="rocket-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-rocket"> <path d="M14.064 0h.186C15.216 0 16 .784 16 1.75v.186a8.752 8.752 0 0 1-2.564 6.186l-.458.459c-.314.314-.641.616-.979.904v3.207c0 .608-.315 1.172-.833 1.49l-2.774 1.707a.749.749 0 0 1-1.11-.418l-.954-3.102a1.214 1.214 0 0 1-.145-.125L3.754 9.816a1.218 1.218 0 0 1-.124-.145L.528 8.717a.749.749 0 0 1-.418-1.11l1.71-2.774A1.748 1.748 0 0 1 3.31 4h3.204c.288-.338.59-.665.904-.979l.459-.458A8.749 8.749 0 0 1 14.064 0ZM8.938 3.623h-.002l-.458.458c-.76.76-1.437 1.598-2.02 2.5l-1.5 2.317 2.143 2.143 2.317-1.5c.902-.583 1.74-1.26 2.499-2.02l.459-.458a7.25 7.25 0 0 0 2.123-5.127V1.75a.25.25 0 0 0-.25-.25h-.186a7.249 7.249 0 0 0-5.125 2.123ZM3.56 14.56c-.732.732-2.334 1.045-3.005 1.148a.234.234 0 0 1-.201-.064.234.234 0 0 1-.064-.201c.103-.671.416-2.273 1.15-3.003a1.502 1.502 0 1 1 2.12 2.12Zm6.94-3.935c-.088.06-.177.118-.266.175l-2.35 1.521.548 1.783 1.949-1.2a.25.25 0 0 0 .119-.213ZM3.678 8.116 5.2 5.766c.058-.09.117-.178.176-.266H3.309a.25.25 0 0 0-.213.119l-1.2 1.95ZM12 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> </template> <template id="shield-check-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield-check"> <path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.36.275 2.666 1.057 3.859.784 1.194 2.121 2.342 4.366 3.298a.196.196 0 0 0 .154 0c2.245-.957 3.582-2.103 4.366-3.297C13.225 9.666 13.5 8.358 13.5 7V3.48a.25.25 0 0 0-.174-.238l-5.25-1.68a.25.25 0 0 0-.153 0ZM11.28 6.28l-3.5 3.5a.75.75 0 0 1-1.06 0l-1.5-1.5a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215l.97.97 2.97-2.97a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </template> <template id="heart-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-heart"> <path d="m8 14.25.345.666a.75.75 0 0 1-.69 0l-.008-.004-.018-.01a7.152 7.152 0 0 1-.31-.17 22.055 22.055 0 0 1-3.434-2.414C2.045 10.731 0 8.35 0 5.5 0 2.836 2.086 1 4.25 1 5.797 1 7.153 1.802 8 3.02 8.847 1.802 10.203 1 11.75 1 13.914 1 16 2.836 16 5.5c0 2.85-2.045 5.231-3.885 6.818a22.066 22.066 0 0 1-3.744 2.584l-.018.01-.006.003h-.002ZM4.25 2.5c-1.336 0-2.75 1.164-2.75 3 0 2.15 1.58 4.144 3.365 5.682A20.58 20.58 0 0 0 8 13.393a20.58 20.58 0 0 0 3.135-2.211C12.92 9.644 14.5 7.65 14.5 5.5c0-1.836-1.414-3-2.75-3-1.373 0-2.609.986-3.029 2.456a.749.749 0 0 1-1.442 0C6.859 3.486 5.623 2.5 4.25 2.5Z"></path> </svg> </template> <template id="server-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-server"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v4c0 .372-.116.717-.314 1 .198.283.314.628.314 1v4a1.75 1.75 0 0 1-1.75 1.75H1.75A1.75 1.75 0 0 1 0 12.75v-4c0-.358.109-.707.314-1a1.739 1.739 0 0 1-.314-1v-4C0 1.784.784 1 1.75 1ZM1.5 2.75v4c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Zm.25 5.75a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25ZM7 4.75A.75.75 0 0 1 7.75 4h4.5a.75.75 0 0 1 0 1.5h-4.5A.75.75 0 0 1 7 4.75ZM7.75 10h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM3 4.75A.75.75 0 0 1 3.75 4h.5a.75.75 0 0 1 0 1.5h-.5A.75.75 0 0 1 3 4.75ZM3.75 10h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1 0-1.5Z"></path> </svg> </template> <template id="globe-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-globe"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM5.78 8.75a9.64 9.64 0 0 0 1.363 4.177c.255.426.542.832.857 1.215.245-.296.551-.705.857-1.215A9.64 9.64 0 0 0 10.22 8.75Zm4.44-1.5a9.64 9.64 0 0 0-1.363-4.177c-.307-.51-.612-.919-.857-1.215a9.927 9.927 0 0 0-.857 1.215A9.64 9.64 0 0 0 5.78 7.25Zm-5.944 1.5H1.543a6.507 6.507 0 0 0 4.666 5.5c-.123-.181-.24-.365-.352-.552-.715-1.192-1.437-2.874-1.581-4.948Zm-2.733-1.5h2.733c.144-2.074.866-3.756 1.58-4.948.12-.197.237-.381.353-.552a6.507 6.507 0 0 0-4.666 5.5Zm10.181 1.5c-.144 2.074-.866 3.756-1.58 4.948-.12.197-.237.381-.353.552a6.507 6.507 0 0 0 4.666-5.5Zm2.733-1.5a6.507 6.507 0 0 0-4.666-5.5c.123.181.24.365.353.552.714 1.192 1.436 2.874 1.58 4.948Z"></path> </svg> </template> <template id="issue-opened-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path> </svg> </template> <template id="device-mobile-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-device-mobile"> <path d="M3.75 0h8.5C13.216 0 14 .784 14 1.75v12.5A1.75 1.75 0 0 1 12.25 16h-8.5A1.75 1.75 0 0 1 2 14.25V1.75C2 .784 2.784 0 3.75 0ZM3.5 1.75v12.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25ZM8 13a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path> </svg> </template> <template id="package-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-package"> <path d="m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"></path> </svg> </template> <template id="credit-card-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-credit-card"> <path d="M10.75 9a.75.75 0 0 0 0 1.5h1.5a.75.75 0 0 0 0-1.5h-1.5Z"></path><path d="M0 3.75C0 2.784.784 2 1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25ZM14.5 6.5h-13v5.75c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25Zm0-2.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25V5h13Z"></path> </svg> </template> <template id="play-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path> </svg> </template> <template id="gift-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-gift"> <path d="M2 2.75A2.75 2.75 0 0 1 4.75 0c.983 0 1.873.42 2.57 1.232.268.318.497.668.68 1.042.183-.375.411-.725.68-1.044C9.376.42 10.266 0 11.25 0a2.75 2.75 0 0 1 2.45 4h.55c.966 0 1.75.784 1.75 1.75v2c0 .698-.409 1.301-1 1.582v4.918A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25V9.332C.409 9.05 0 8.448 0 7.75v-2C0 4.784.784 4 1.75 4h.55c-.192-.375-.3-.8-.3-1.25ZM7.25 9.5H2.5v4.75c0 .138.112.25.25.25h4.5Zm1.5 0v5h4.5a.25.25 0 0 0 .25-.25V9.5Zm0-4V8h5.5a.25.25 0 0 0 .25-.25v-2a.25.25 0 0 0-.25-.25Zm-7 0a.25.25 0 0 0-.25.25v2c0 .138.112.25.25.25h5.5V5.5h-5.5Zm3-4a1.25 1.25 0 0 0 0 2.5h2.309c-.233-.818-.542-1.401-.878-1.793-.43-.502-.915-.707-1.431-.707ZM8.941 4h2.309a1.25 1.25 0 0 0 0-2.5c-.516 0-1 .205-1.43.707-.337.392-.646.975-.879 1.793Z"></path> </svg> </template> <template id="code-square-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code-square"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25Zm7.47 3.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L10.69 8 9.22 6.53a.75.75 0 0 1 0-1.06ZM6.78 6.53 5.31 8l1.47 1.47a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </template> <template id="device-desktop-icon"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-device-desktop"> <path d="M14.25 1c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 14.25 12h-3.727c.099 1.041.52 1.872 1.292 2.757A.752.752 0 0 1 11.25 16h-6.5a.75.75 0 0 1-.565-1.243c.772-.885 1.192-1.716 1.292-2.757H1.75A1.75 1.75 0 0 1 0 10.25v-7.5C0 1.784.784 1 1.75 1ZM1.75 2.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25ZM9.018 12H6.982a5.72 5.72 0 0 1-.765 2.5h3.566a5.72 5.72 0 0 1-.765-2.5Z"></path> </svg> </template> <div class="position-relative"> <ul role="listbox" class="ActionListWrap QueryBuilder-ListWrap" aria-label="Suggestions" data-action=" combobox-commit:query-builder#comboboxCommit mousedown:query-builder#resultsMousedown " data-target="query-builder.resultsList" data-persist-list=false id="query-builder-test-results" ></ul> </div> <div class="FormControl-inlineValidation" id="validation-2804db65-75ba-47b1-af96-9dd28feb7013" hidden="hidden"> <span class="FormControl-inlineValidation--visual"> <svg aria-hidden="true" height="12" viewBox="0 0 12 12" version="1.1" width="12" data-view-component="true" class="octicon octicon-alert-fill"> <path d="M4.855.708c.5-.896 1.79-.896 2.29 0l4.675 8.351a1.312 1.312 0 0 1-1.146 1.954H1.33A1.313 1.313 0 0 1 .183 9.058ZM7 7V3H5v4Zm-1 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path> </svg> </span> <span></span> </div> </div> <div data-target="query-builder.screenReaderFeedback" aria-live="polite" aria-atomic="true" class="sr-only"></div> </query-builder></form> <div class="d-flex flex-row color-fg-muted px-3 text-small color-bg-default search-feedback-prompt"> <a target="_blank" href="https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax" data-view-component="true" class="Link color-fg-accent text-normal ml-2">Search syntax tips</a> <div class="d-flex flex-1"></div> </div> </div> </div> </div> </modal-dialog></div> </div> <div data-action="click:qbsearch-input#retract" class="dark-backdrop position-fixed" hidden data-target="qbsearch-input.darkBackdrop"></div> <div class="color-fg-default"> <dialog-helper> <dialog data-target="qbsearch-input.feedbackDialog" data-action="close:qbsearch-input#handleDialogClose cancel:qbsearch-input#handleDialogClose" id="feedback-dialog" aria-modal="true" aria-labelledby="feedback-dialog-title" aria-describedby="feedback-dialog-description" data-view-component="true" class="Overlay Overlay-whenNarrow Overlay--size-medium Overlay--motion-scaleFade Overlay--disableScroll"> <div data-view-component="true" class="Overlay-header"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 class="Overlay-title " id="feedback-dialog-title"> Provide feedback </h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="feedback-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg></button> </div> </div> </div> <scrollable-region data-labelled-by="feedback-dialog-title"> <div data-view-component="true" class="Overlay-body"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="code-search-feedback-form" data-turbo="false" action="/search/feedback" accept-charset="UTF-8" method="post"><input type="hidden" data-csrf="true" name="authenticity_token" value="GOBm9WeFik1mjO/QPGeaUiV03M3I6og+qJXV1MKp586vZMc2vmjE+6bZ0khHHQd7GPzeSrmR30uaLUE7bEA7Xg==" /> <p>We read every piece of feedback, and take your input very seriously.</p> <textarea name="feedback" class="form-control width-full mb-2" style="height: 120px" id="feedback"></textarea> <input name="include_email" id="include_email" aria-label="Include my email address so I can be contacted" class="form-control mr-2" type="checkbox"> <label for="include_email" style="font-weight: normal">Include my email address so I can be contacted</label> </form></div> </scrollable-region> <div data-view-component="true" class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="feedback-dialog" type="button" data-view-component="true" class="btn"> Cancel </button> <button form="code-search-feedback-form" data-action="click:qbsearch-input#submitFeedback" type="submit" data-view-component="true" class="btn-primary btn"> Submit feedback </button> </div> </dialog></dialog-helper> <custom-scopes data-target="qbsearch-input.customScopesManager"> <dialog-helper> <dialog data-target="custom-scopes.customScopesModalDialog" data-action="close:qbsearch-input#handleDialogClose cancel:qbsearch-input#handleDialogClose" id="custom-scopes-dialog" aria-modal="true" aria-labelledby="custom-scopes-dialog-title" aria-describedby="custom-scopes-dialog-description" data-view-component="true" class="Overlay Overlay-whenNarrow Overlay--size-medium Overlay--motion-scaleFade Overlay--disableScroll"> <div data-view-component="true" class="Overlay-header Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 class="Overlay-title " id="custom-scopes-dialog-title"> Saved searches </h1> <h2 id="custom-scopes-dialog-description" class="Overlay-description">Use saved searches to filter your results more quickly</h2> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="custom-scopes-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg></button> </div> </div> </div> <scrollable-region data-labelled-by="custom-scopes-dialog-title"> <div data-view-component="true" class="Overlay-body"> <div data-target="custom-scopes.customScopesModalDialogFlash"></div> <div hidden class="create-custom-scope-form" data-target="custom-scopes.createCustomScopeForm"> <!-- '"` --><!-- </textarea></xmp> --></option></form><form id="custom-scopes-dialog-form" data-turbo="false" action="/search/custom_scopes" accept-charset="UTF-8" method="post"><input type="hidden" data-csrf="true" name="authenticity_token" value="0pauF3EcI2MLb4ijaygv7F52Soh5tT/yolrzoLoOH8FR08AM2NhJz3NskR2som7DJsETGX02CaPjAxxrQkACtQ==" /> <div data-target="custom-scopes.customScopesModalDialogFlash"></div> <input type="hidden" id="custom_scope_id" name="custom_scope_id" data-target="custom-scopes.customScopesIdField"> <div class="form-group"> <label for="custom_scope_name">Name</label> <auto-check src="/search/custom_scopes/check_name" required only-validate-on-blur="false"> <input type="text" name="custom_scope_name" id="custom_scope_name" data-target="custom-scopes.customScopesNameField" class="form-control" autocomplete="off" placeholder="github-ruby" required maxlength="50"> <input type="hidden" data-csrf="true" value="Eg+k0/310Aqa242ZPNL9uydl066P5OVhKcWKnDtqvjg314RCTXo4DokX0E3tqMuWAeUT3YO2f/oJSHONvEZrJw==" /> </auto-check> </div> <div class="form-group"> <label for="custom_scope_query">Query</label> <input type="text" name="custom_scope_query" id="custom_scope_query" data-target="custom-scopes.customScopesQueryField" class="form-control" autocomplete="off" placeholder="(repo:mona/a OR repo:mona/b) AND lang:python" required maxlength="500"> </div> <p class="text-small color-fg-muted"> To see all available qualifiers, see our <a class="Link--inTextBlock" href="https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax">documentation</a>. </p> </form> </div> <div data-target="custom-scopes.manageCustomScopesForm"> <div data-target="custom-scopes.list"></div> </div> </div> </scrollable-region> <div data-view-component="true" class="Overlay-footer Overlay-footer--alignEnd Overlay-footer--divided"> <button data-action="click:custom-scopes#customScopesCancel" type="button" data-view-component="true" class="btn"> Cancel </button> <button form="custom-scopes-dialog-form" data-action="click:custom-scopes#customScopesSubmit" data-target="custom-scopes.customScopesSubmitButton" type="submit" data-view-component="true" class="btn-primary btn"> Create saved search </button> </div> </dialog></dialog-helper> </custom-scopes> </div> </qbsearch-input> <div class="position-relative HeaderMenu-link-wrap d-lg-inline-block"> <a href="/login?return_to=https%3A%2F%2Fgithub.com%2Fhuihut%2Finterview%2Fblob%2Fmaster%2FREADME_en.md" class="HeaderMenu-link HeaderMenu-link--sign-in HeaderMenu-button flex-shrink-0 no-underline d-none d-lg-inline-flex border border-lg-0 rounded rounded-lg-0 px-2 py-1" style="margin-left: 12px;" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://github.com/huihut/interview/blob/master/README_en.md","user_id":null}}" data-hydro-click-hmac="b94661aff3a4ed9fb1aba09ac8a24820f61ef244a141c8eff031fa2251141f5d" data-analytics-event="{"category":"Marketing nav","action":"click to go to homepage","label":"ref_page:Marketing;ref_cta:Sign in;ref_loc:Header"}" > Sign in </a> </div> <a href="/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fblob%2Fshow&source=header-repo&source_repo=huihut%2Finterview" class="HeaderMenu-link HeaderMenu-link--sign-up HeaderMenu-button flex-shrink-0 d-flex d-lg-inline-flex no-underline border color-border-default rounded px-2 py-1" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"site header menu","repository_id":null,"auth_type":"SIGN_UP","originating_url":"https://github.com/huihut/interview/blob/master/README_en.md","user_id":null}}" data-hydro-click-hmac="b94661aff3a4ed9fb1aba09ac8a24820f61ef244a141c8eff031fa2251141f5d" data-analytics-event="{"category":"Sign up","action":"click to sign up for account","label":"ref_page:/<user-name>/<repo-name>/blob/show;ref_cta:Sign up;ref_loc:header logged out"}" > Sign up </a> <button type="button" class="sr-only js-header-menu-focus-trap d-block d-lg-none">Reseting focus</button> </div> </div> </div> </div> </header> <div hidden="hidden" data-view-component="true" class="js-stale-session-flash stale-session-flash flash flash-warn flash-full"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> <span class="js-stale-session-flash-signed-in" hidden>You signed in with another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span> <span class="js-stale-session-flash-signed-out" hidden>You signed out in another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span> <span class="js-stale-session-flash-switched" hidden>You switched accounts on another tab or window. <a class="Link--inTextBlock" href="">Reload</a> to refresh your session.</span> <button id="icon-button-e0ff0853-9863-4e6c-a073-e4e63ce22b5f" aria-labelledby="tooltip-7514e3a9-061b-40f7-aa34-0d8ef0c1582b" type="button" data-view-component="true" class="Button Button--iconOnly Button--invisible Button--medium flash-close js-flash-close"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x Button-visual"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button><tool-tip id="tooltip-7514e3a9-061b-40f7-aa34-0d8ef0c1582b" for="icon-button-e0ff0853-9863-4e6c-a073-e4e63ce22b5f" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Dismiss alert</tool-tip> </div> </div> <div id="start-of-content" class="show-on-focus"></div> <div id="js-flash-container" class="flash-container" data-turbo-replace> <template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div> </div> </div> </div> </template> </div> <div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled data-project-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" > <div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--page-header-bgColor, var(--color-page-header-bg));" data-turbo-replace> <div class="d-flex flex-nowrap flex-justify-end mb-3 px-3 px-lg-5" style="gap: 1rem;"> <div class="flex-auto min-width-0 width-fit"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path> </svg> <span class="author flex-self-stretch" itemprop="author"> <a class="url fn" rel="author" data-hovercard-type="user" data-hovercard-url="/users/huihut/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/huihut"> huihut </a> </span> <span class="mx-1 flex-self-stretch color-fg-muted">/</span> <strong itemprop="name" class="mr-2 flex-self-stretch"> <a data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" href="/huihut/interview">interview</a> </strong> <span></span><span class="Label Label--secondary v-align-middle mr-1">Public</span> </div> </div> <div id="repository-details-container" class="flex-shrink-0" data-turbo-replace style="max-width: 70%;"> <ul class="pagehead-actions flex-shrink-0 d-none d-md-inline" style="padding: 2px 0;"> <li> <a href="/login?return_to=%2Fhuihut%2Finterview" rel="nofollow" id="repository-details-watch-button" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"notification subscription menu watch","repository_id":null,"auth_type":"LOG_IN","originating_url":"https://github.com/huihut/interview/blob/master/README_en.md","user_id":null}}" data-hydro-click-hmac="dc90f9be0b23f43922604fb3f2315731a64868b803d77543653b28601455aba4" aria-label="You must be signed in to change notification settings" data-view-component="true" class="btn-sm btn"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path> </svg>Notifications </a> <tool-tip id="tooltip-784c22e5-cd64-4e48-9b9a-c07502abfcf8" for="repository-details-watch-button" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">You must be signed in to change notification settings</tool-tip> </li> <li> <a icon="repo-forked" id="fork-button" href="/login?return_to=%2Fhuihut%2Finterview" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"repo details fork button","repository_id":120887835,"auth_type":"LOG_IN","originating_url":"https://github.com/huihut/interview/blob/master/README_en.md","user_id":null}}" data-hydro-click-hmac="0c4253f61653d85a62b925dd433bdf27356556b59b7530993e13825d20359ef4" data-view-component="true" class="btn-sm btn"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path> </svg>Fork <span id="repo-network-counter" data-pjax-replace="true" data-turbo-replace="true" title="8,024" data-view-component="true" class="Counter">8k</span> </a> </li> <li> <div data-view-component="true" class="BtnGroup d-flex"> <a href="/login?return_to=%2Fhuihut%2Finterview" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"star button","repository_id":120887835,"auth_type":"LOG_IN","originating_url":"https://github.com/huihut/interview/blob/master/README_en.md","user_id":null}}" data-hydro-click-hmac="00aff788a68a2b1161fe86b6dd09cdad9c48d0ae8a75a8fa419c2c9d50606e73" aria-label="You must be signed in to star a repository" data-view-component="true" class="tooltipped tooltipped-sw btn-sm btn"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path> </svg><span data-view-component="true" class="d-inline"> Star </span> <span id="repo-stars-counter-star" aria-label="35509 users starred this repository" data-singular-suffix="user starred this repository" data-plural-suffix="users starred this repository" data-turbo-replace="true" title="35,509" data-view-component="true" class="Counter js-social-count">35.5k</span> </a></div> </li> </ul> </div> </div> <div id="responsive-meta-container" data-turbo-replace> </div> <nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5"> <ul data-view-component="true" class="UnderlineNav-body list-style-none"> <li data-view-component="true" class="d-inline-flex"> <a id="code-tab" href="/huihut/interview" data-tab-item="i0code-tab" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches repo_packages repo_deployments repo_attestations /huihut/interview" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g c" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Code","target":"UNDERLINE_NAV.TAB"}" aria-current="page" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item selected"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path> </svg> <span data-content="Code">Code</span> <span id="code-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="issues-tab" href="/huihut/interview/issues" data-tab-item="i1issues-tab" data-selected-links="repo_issues repo_labels repo_milestones /huihut/interview/issues" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g i" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Issues","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path> </svg> <span data-content="Issues">Issues</span> <span id="issues-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="24" data-view-component="true" class="Counter">24</span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="pull-requests-tab" href="/huihut/interview/pulls" data-tab-item="i2pull-requests-tab" data-selected-links="repo_pulls checks /huihut/interview/pulls" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g p" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Pull requests","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path> </svg> <span data-content="Pull requests">Pull requests</span> <span id="pull-requests-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="2" data-view-component="true" class="Counter">2</span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="actions-tab" href="/huihut/interview/actions" data-tab-item="i3actions-tab" data-selected-links="repo_actions /huihut/interview/actions" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g a" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Actions","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path> </svg> <span data-content="Actions">Actions</span> <span id="actions-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="projects-tab" href="/huihut/interview/projects" data-tab-item="i4projects-tab" data-selected-links="repo_projects new_repo_project repo_project /huihut/interview/projects" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g b" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Projects","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path> </svg> <span data-content="Projects">Projects</span> <span id="projects-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="0" hidden="hidden" data-view-component="true" class="Counter">0</span> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="security-tab" href="/huihut/interview/security" data-tab-item="i5security-tab" data-selected-links="security overview alerts policy token_scanning code_scanning /huihut/interview/security" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-hotkey="g s" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Security","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> <span data-content="Security">Security</span> <include-fragment src="/huihut/interview/security/overall-count" accept="text/fragment+html"></include-fragment> </a></li> <li data-view-component="true" class="d-inline-flex"> <a id="insights-tab" href="/huihut/interview/pulse" data-tab-item="i6insights-tab" data-selected-links="repo_graphs repo_contributors dependency_graph dependabot_updates pulse people community /huihut/interview/pulse" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame" data-analytics-event="{"category":"Underline navbar","action":"Click tab","label":"Insights","target":"UNDERLINE_NAV.TAB"}" data-view-component="true" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> <span data-content="Insights">Insights</span> <span id="insights-repo-tab-count" data-pjax-replace="" data-turbo-replace="" title="Not available" data-view-component="true" class="Counter"></span> </a></li> </ul> <div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <action-menu data-select-variant="none" data-view-component="true"> <focus-group direction="vertical" mnemonics retain> <button id="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-button" popovertarget="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-overlay" aria-controls="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-list" aria-haspopup="true" aria-labelledby="tooltip-2a8f6c3b-1d6b-4081-bfe7-03e859e6b8ba" type="button" data-view-component="true" class="Button Button--iconOnly Button--secondary Button--medium UnderlineNav-item"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal Button-visual"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path> </svg> </button><tool-tip id="tooltip-2a8f6c3b-1d6b-4081-bfe7-03e859e6b8ba" for="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-button" popover="manual" data-direction="s" data-type="label" data-view-component="true" class="sr-only position-absolute">Additional navigation options</tool-tip> <anchored-position data-target="action-menu.overlay" id="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-overlay" anchor="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-button" align="start" side="outside-bottom" anchor-offset="normal" popover="auto" data-view-component="true"> <div data-view-component="true" class="Overlay Overlay--size-auto"> <div data-view-component="true" class="Overlay-body Overlay-body--paddingNone"> <action-list> <div data-view-component="true"> <ul aria-labelledby="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-button" id="action-menu-3ec76a2d-3aa8-4cc6-995b-2c4289694152-list" role="menu" data-view-component="true" class="ActionListWrap--inset ActionListWrap"> <li hidden="hidden" data-menu-item="i0code-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-b0507e21-c3d9-499f-87a0-685730f14b52" href="/huihut/interview" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Code </span> </a> </li> <li hidden="hidden" data-menu-item="i1issues-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-c5070ea5-69c8-4fcf-8191-e71226fcc00d" href="/huihut/interview/issues" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Issues </span> </a> </li> <li hidden="hidden" data-menu-item="i2pull-requests-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-acd9e30f-6c02-4889-b6f5-90098fd97e8f" href="/huihut/interview/pulls" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Pull requests </span> </a> </li> <li hidden="hidden" data-menu-item="i3actions-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-a18bb269-324f-4ad3-b5a8-3a44a1fd0ecf" href="/huihut/interview/actions" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Actions </span> </a> </li> <li hidden="hidden" data-menu-item="i4projects-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-e54b8461-415b-4953-a9e3-2e581d3f1ac1" href="/huihut/interview/projects" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Projects </span> </a> </li> <li hidden="hidden" data-menu-item="i5security-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-3dedb465-7c7a-4746-bbec-2975b18176de" href="/huihut/interview/security" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Security </span> </a> </li> <li hidden="hidden" data-menu-item="i6insights-tab" data-targets="action-list.items" role="none" data-view-component="true" class="ActionListItem"> <a tabindex="-1" id="item-9021af11-5791-4e40-ac23-7021cf790723" href="/huihut/interview/pulse" role="menuitem" data-view-component="true" class="ActionListContent ActionListContent--visual16"> <span class="ActionListItem-visual ActionListItem-visual--leading"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path> </svg> </span> <span data-view-component="true" class="ActionListItem-label"> Insights </span> </a> </li> </ul> </div></action-list> </div> </div></anchored-position> </focus-group> </action-menu></div> </nav> </div> <turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " > <react-app app-name="react-code-view" initial-path="/huihut/interview/blob/master/README_en.md" style="display: block; min-height: calc(100vh - 64px);" data-attempted-ssr="true" data-ssr="true" data-lazy="false" data-alternate="false" data-data-router-enabled="false" > <script type="application/json" data-target="react-app.embeddedData">{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"Algorithm","path":"Algorithm","contentType":"directory"},{"name":"DataStructure","path":"DataStructure","contentType":"directory"},{"name":"DesignPattern","path":"DesignPattern","contentType":"directory"},{"name":"Problems","path":"Problems","contentType":"directory"},{"name":"STL","path":"STL","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"images","path":"images","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"README_en.md","path":"README_en.md","contentType":"file"}],"totalCount":11}},"fileTreeProcessingTime":2.4715700000000003,"foldersToFetch":[],"repo":{"id":120887835,"defaultBranch":"master","name":"interview","ownerLogin":"huihut","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2018-02-09T09:49:48.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/23519480?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1587301245.0","canEdit":false,"refType":"branch","currentOid":"77b04416e2c7b60750ca3740c2c12e1ee6374500"},"path":"README_en.md","currentUser":null,"blob":{"rawLines":null,"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/huihut/interview/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"README_en.md","displayUrl":"https://github.com/huihut/interview/blob/master/README_en.md?raw=true","headerInfo":{"blobSize":"163 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"0ebb0e9","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fhuihut%2Finterview%2Fblob%2Fmaster%2FREADME_en.md","isCSV":false,"isRichtext":true,"toc":[{"level":2,"text":"📑 Table of contents","anchor":"-table-of-contents","htmlText":"📑 Table of contents"},{"level":2,"text":"➕ C/C++","anchor":"-cc","htmlText":"➕ C/C++"},{"level":3,"text":"const","anchor":"const","htmlText":"const"},{"level":4,"text":"Function","anchor":"function","htmlText":"Function"},{"level":4,"text":"const Pointers and references","anchor":"const-pointers-and-references","htmlText":"const Pointers and references"},{"level":4,"text":"use","anchor":"use","htmlText":"use"},{"level":4,"text":"#define and const constants","anchor":"define-and-const-constants","htmlText":"#define and const constants"},{"level":3,"text":"static","anchor":"static","htmlText":"static"},{"level":4,"text":"Function","anchor":"function-1","htmlText":"Function"},{"level":3,"text":"this pointer","anchor":"this-pointer","htmlText":"this pointer"},{"level":3,"text":"inline function","anchor":"inline-function","htmlText":"inline function"},{"level":4,"text":"Features","anchor":"features","htmlText":"Features"},{"level":4,"text":"use","anchor":"use-1","htmlText":"use"},{"level":4,"text":"Compiler processing steps for inline functions","anchor":"compiler-processing-steps-for-inline-functions","htmlText":"Compiler processing steps for inline functions"},{"level":4,"text":"Advantages and disadvantages","anchor":"advantages-and-disadvantages","htmlText":"Advantages and disadvantages"},{"level":4,"text":"Can a virtual function be an inline function?","anchor":"can-a-virtual-function-be-an-inline-function","htmlText":"Can a virtual function be an inline function?"},{"level":3,"text":"volatile","anchor":"volatile","htmlText":"volatile"},{"level":3,"text":"assert()","anchor":"assert","htmlText":"assert()"},{"level":3,"text":"sizeof()","anchor":"sizeof","htmlText":"sizeof()"},{"level":3,"text":"#pragma pack(n)","anchor":"pragma-packn","htmlText":"#pragma pack(n)"},{"level":3,"text":"Bit field","anchor":"bit-field","htmlText":"Bit field"},{"level":3,"text":"extern \"C\"","anchor":"extern-c","htmlText":"extern \"C\""},{"level":3,"text":"struct with typedef struct","anchor":"struct-with-typedef-struct","htmlText":"struct with typedef struct"},{"level":4,"text":"In C","anchor":"in-c","htmlText":"In C"},{"level":4,"text":"In C++","anchor":"in-c-1","htmlText":"In C++"},{"level":3,"text":"struct and class in C ++","anchor":"struct-and-class-in-c-","htmlText":"struct and class in C ++"},{"level":4,"text":"The difference","anchor":"the-difference","htmlText":"The difference"},{"level":3,"text":"union union","anchor":"union-union","htmlText":"union union"},{"level":3,"text":"C implements C ++ classes","anchor":"c-implements-c--classes","htmlText":"C implements C ++ classes"},{"level":3,"text":"explicit (keyword)","anchor":"explicit-keyword","htmlText":"explicit (keyword)"},{"level":3,"text":"friend - friend class and friend function","anchor":"friend---friend-class-and-friend-function","htmlText":"friend - friend class and friend function"},{"level":3,"text":"using","anchor":"using","htmlText":"using"},{"level":4,"text":"using statement","anchor":"using-statement","htmlText":"using statement"},{"level":4,"text":"Using declaration of constructor","anchor":"using-declaration-of-constructor","htmlText":"Using declaration of constructor"},{"level":4,"text":"using instructions","anchor":"using-instructions","htmlText":"using instructions"},{"level":4,"text":"Minimize using directives to pollute namespaces","anchor":"minimize-using-directives-to-pollute-namespaces","htmlText":"Minimize using directives to pollute namespaces"},{"level":3,"text":":: scope resolution operator","anchor":"-scope-resolution-operator","htmlText":":: scope resolution operator"},{"level":4,"text":"classification","anchor":"classification","htmlText":"classification"},{"level":3,"text":"enum - enum type","anchor":"enum---enum-type","htmlText":"enum - enum type"},{"level":4,"text":"Scoped Enumeration Type","anchor":"scoped-enumeration-type","htmlText":"Scoped Enumeration Type"},{"level":4,"text":"Unscoped enumeration type","anchor":"unscoped-enumeration-type","htmlText":"Unscoped enumeration type"},{"level":3,"text":"decltype","anchor":"decltype","htmlText":"decltype"},{"level":3,"text":"reference","anchor":"reference","htmlText":"reference"},{"level":4,"text":"lvalue reference","anchor":"lvalue-reference","htmlText":"lvalue reference"},{"level":4,"text":"rvalue reference","anchor":"rvalue-reference","htmlText":"rvalue reference"},{"level":4,"text":"Reference Collapse","anchor":"reference-collapse","htmlText":"Reference Collapse"},{"level":3,"text":"Macro","anchor":"macro","htmlText":"Macro"},{"level":3,"text":"Member initialization list","anchor":"member-initialization-list","htmlText":"Member initialization list"},{"level":3,"text":"initializer_list list initialization","anchor":"initializer_list-list-initialization","htmlText":"initializer_list list initialization"},{"level":3,"text":"Object-oriented","anchor":"object-oriented","htmlText":"Object-oriented"},{"level":3,"text":"Encapsulation","anchor":"encapsulation","htmlText":"Encapsulation"},{"level":3,"text":"Inheritance","anchor":"inheritance","htmlText":"Inheritance"},{"level":3,"text":"Polymorphism","anchor":"polymorphism","htmlText":"Polymorphism"},{"level":4,"text":"Static polymorphism (compile time / early binding)","anchor":"static-polymorphism-compile-time--early-binding","htmlText":"Static polymorphism (compile time / early binding)"},{"level":4,"text":"Dynamic polymorphism (runtime / late binding)","anchor":"dynamic-polymorphism-runtime--late-binding","htmlText":"Dynamic polymorphism (runtime / late binding)"},{"level":3,"text":"Virtual destructor","anchor":"virtual-destructor","htmlText":"Virtual destructor"},{"level":3,"text":"Pure virtual functions","anchor":"pure-virtual-functions","htmlText":"Pure virtual functions"},{"level":3,"text":"Virtual functions, pure virtual functions","anchor":"virtual-functions-pure-virtual-functions","htmlText":"Virtual functions, pure virtual functions"},{"level":3,"text":"Virtual function pointer, virtual function table","anchor":"virtual-function-pointer-virtual-function-table","htmlText":"Virtual function pointer, virtual function table"},{"level":3,"text":"Virtual inheritance","anchor":"virtual-inheritance","htmlText":"Virtual inheritance"},{"level":3,"text":"Virtual inheritance, virtual functions","anchor":"virtual-inheritance-virtual-functions","htmlText":"Virtual inheritance, virtual functions"},{"level":3,"text":"Template classes, member templates, virtual functions","anchor":"template-classes-member-templates-virtual-functions","htmlText":"Template classes, member templates, virtual functions"},{"level":3,"text":"Abstract class, interface class, aggregate class","anchor":"abstract-class-interface-class-aggregate-class","htmlText":"Abstract class, interface class, aggregate class"},{"level":3,"text":"Memory allocation and management","anchor":"memory-allocation-and-management","htmlText":"Memory allocation and management"},{"level":4,"text":"malloc, calloc, realloc, alloca","anchor":"malloc-calloc-realloc-alloca","htmlText":"malloc, calloc, realloc, alloca"},{"level":4,"text":"malloc, free","anchor":"malloc-free","htmlText":"malloc, free"},{"level":4,"text":"new、delete","anchor":"newdelete","htmlText":"new、delete"},{"level":4,"text":"Positioning new","anchor":"positioning-new","htmlText":"Positioning new"},{"level":3,"text":"delete this - Is it legal?","anchor":"delete-this---is-it-legal","htmlText":"delete this - Is it legal?"},{"level":3,"text":"How to define a class that can only generate objects on the heap (on the stack)?","anchor":"how-to-define-a-class-that-can-only-generate-objects-on-the-heap-on-the-stack","htmlText":"How to define a class that can only generate objects on the heap (on the stack)?"},{"level":4,"text":"Only on the heap","anchor":"only-on-the-heap","htmlText":"Only on the heap"},{"level":4,"text":"Only on the stack","anchor":"only-on-the-stack","htmlText":"Only on the stack"},{"level":3,"text":"Smart pointer","anchor":"smart-pointer","htmlText":"Smart pointer"},{"level":4,"text":"In the C ++ Standard Library (STL)","anchor":"in-the-c--standard-library-stl","htmlText":"In the C ++ Standard Library (STL)"},{"level":4,"text":"C++ 98","anchor":"c-98","htmlText":"C++ 98"},{"level":4,"text":"C++ 11","anchor":"c-11","htmlText":"C++ 11"},{"level":5,"text":"shared_ptr","anchor":"shared_ptr","htmlText":"shared_ptr"},{"level":5,"text":"weak_ptr","anchor":"weak_ptr","htmlText":"weak_ptr"},{"level":5,"text":"unique_ptr","anchor":"unique_ptr","htmlText":"unique_ptr"},{"level":5,"text":"auto_ptr","anchor":"auto_ptr","htmlText":"auto_ptr"},{"level":5,"text":"auto_ptr compared to unique_ptr","anchor":"auto_ptr-compared-to-unique_ptr","htmlText":"auto_ptr compared to unique_ptr"},{"level":3,"text":"Casting Operator","anchor":"casting-operator","htmlText":"Casting Operator"},{"level":4,"text":"static_cast","anchor":"static_cast","htmlText":"static_cast"},{"level":4,"text":"dynamic_cast","anchor":"dynamic_cast","htmlText":"dynamic_cast"},{"level":4,"text":"const_cast","anchor":"const_cast","htmlText":"const_cast"},{"level":4,"text":"reinterpret_cast","anchor":"reinterpret_cast","htmlText":"reinterpret_cast"},{"level":4,"text":"bad_cast","anchor":"bad_cast","htmlText":"bad_cast"},{"level":3,"text":"Runtime Type Information (RTTI)","anchor":"runtime-type-information-rtti","htmlText":"Runtime Type Information (RTTI)"},{"level":4,"text":"dynamic_cast","anchor":"dynamic_cast-1","htmlText":"dynamic_cast"},{"level":4,"text":"typeid","anchor":"typeid","htmlText":"typeid"},{"level":4,"text":"type_info","anchor":"type_info","htmlText":"type_info"},{"level":2,"text":"⭐️ Effective","anchor":"️-effective","htmlText":"⭐️ Effective"},{"level":3,"text":"Effective C++","anchor":"effective-c","htmlText":"Effective C++"},{"level":3,"text":"More Effective c++","anchor":"more-effective-c","htmlText":"More Effective c++"},{"level":3,"text":"Google C ++ Style Guide","anchor":"google-c--style-guide","htmlText":"Google C ++ Style Guide"},{"level":3,"text":"Other","anchor":"other","htmlText":"Other"},{"level":2,"text":"📦 STL","anchor":"-stl","htmlText":"📦 STL"},{"level":3,"text":"STL index","anchor":"stl-index","htmlText":"STL index"},{"level":3,"text":"STL container","anchor":"stl-container","htmlText":"STL container"},{"level":3,"text":"STL Algorithm","anchor":"stl-algorithm","htmlText":"STL Algorithm"},{"level":2,"text":"〽️ Data Structure","anchor":"️-data-structure","htmlText":"〽️ Data Structure"},{"level":3,"text":"Sequence structure","anchor":"sequence-structure","htmlText":"Sequence structure"},{"level":4,"text":"Sequential stack(Sequence Stack)","anchor":"sequential-stacksequence-stack","htmlText":"Sequential stack(Sequence Stack)"},{"level":4,"text":"queue(Sequence Queue)","anchor":"queuesequence-queue","htmlText":"queue(Sequence Queue)"},{"level":5,"text":"Acyclic queue","anchor":"acyclic-queue","htmlText":"Acyclic queue"},{"level":5,"text":"Circular queue","anchor":"circular-queue","htmlText":"Circular queue"},{"level":4,"text":"Sequence table(Sequence List)","anchor":"sequence-tablesequence-list","htmlText":"Sequence table(Sequence List)"},{"level":3,"text":"Chain structure","anchor":"chain-structure","htmlText":"Chain structure"},{"level":4,"text":"Chain queue(Link Queue)","anchor":"chain-queuelink-queue","htmlText":"Chain queue(Link Queue)"},{"level":4,"text":"Chained representation of a linear list","anchor":"chained-representation-of-a-linear-list","htmlText":"Chained representation of a linear list"},{"level":5,"text":"Singly-Linked list(Link List)","anchor":"singly-linked-listlink-list","htmlText":"Singly-Linked list(Link List)"},{"level":5,"text":"Doubly linked list(Du-Link-List)","anchor":"doubly-linked-listdu-link-list","htmlText":"Doubly linked list(Du-Link-List)"},{"level":5,"text":"Circular linked list(Cir-Link-List)","anchor":"circular-linked-listcir-link-list","htmlText":"Circular linked list(Cir-Link-List)"},{"level":3,"text":"Hash table","anchor":"hash-table","htmlText":"Hash table"},{"level":4,"text":"Concept","anchor":"concept","htmlText":"Concept"},{"level":4,"text":"Construction method","anchor":"construction-method","htmlText":"Construction method"},{"level":4,"text":"Collision resolution method","anchor":"collision-resolution-method","htmlText":"Collision resolution method"},{"level":4,"text":"Hash table data structure for linear probing","anchor":"hash-table-data-structure-for-linear-probing","htmlText":"Hash table data structure for linear probing"},{"level":3,"text":"Recursion","anchor":"recursion","htmlText":"Recursion"},{"level":4,"text":"Concept","anchor":"concept-1","htmlText":"Concept"},{"level":4,"text":"Recursion and Divide","anchor":"recursion-and-divide","htmlText":"Recursion and Divide"},{"level":4,"text":"Recursion and Iteration","anchor":"recursion-and-iteration","htmlText":"Recursion and Iteration"},{"level":4,"text":"Generalized table","anchor":"generalized-table","htmlText":"Generalized table"},{"level":5,"text":"Head and tail linked list storage representation","anchor":"head-and-tail-linked-list-storage-representation","htmlText":"Head and tail linked list storage representation"},{"level":5,"text":"Extended linear linked list storage representation","anchor":"extended-linear-linked-list-storage-representation","htmlText":"Extended linear linked list storage representation"},{"level":3,"text":"Binary tree","anchor":"binary-tree","htmlText":"Binary tree"},{"level":4,"text":"properties","anchor":"properties","htmlText":"properties"},{"level":4,"text":"Storage structure","anchor":"storage-structure","htmlText":"Storage structure"},{"level":5,"text":"Sequential storage","anchor":"sequential-storage","htmlText":"Sequential storage"},{"level":5,"text":"Chained storage","anchor":"chained-storage","htmlText":"Chained storage"},{"level":4,"text":"Traversal","anchor":"traversal","htmlText":"Traversal"},{"level":4,"text":"Categories","anchor":"categories","htmlText":"Categories"},{"level":3,"text":"Other trees and forests","anchor":"other-trees-and-forests","htmlText":"Other trees and forests"},{"level":4,"text":"The storage structure of the tree","anchor":"the-storage-structure-of-the-tree","htmlText":"The storage structure of the tree"},{"level":4,"text":"And check","anchor":"and-check","htmlText":"And check"},{"level":4,"text":"Balanced Binary Tree (AVL Tree)","anchor":"balanced-binary-tree-avl-tree","htmlText":"Balanced Binary Tree (AVL Tree)"},{"level":5,"text":"nature","anchor":"nature","htmlText":"nature"},{"level":5,"text":"Minimal Imbalance Tree","anchor":"minimal-imbalance-tree","htmlText":"Minimal Imbalance Tree"},{"level":4,"text":"Red black tree","anchor":"red-black-tree","htmlText":"Red black tree"},{"level":5,"text":"What are the characteristics of red-black trees?","anchor":"what-are-the-characteristics-of-red-black-trees","htmlText":"What are the characteristics of red-black trees?"},{"level":5,"text":"Adjustment","anchor":"adjustment","htmlText":"Adjustment"},{"level":5,"text":"Application","anchor":"application","htmlText":"Application"},{"level":5,"text":"What is the difference between red and black trees, B trees, and B + trees?","anchor":"what-is-the-difference-between-red-and-black-trees-b-trees-and-b--trees","htmlText":"What is the difference between red and black trees, B trees, and B + trees?"},{"level":4,"text":"B-tree, B + -tree","anchor":"b-tree-b---tree","htmlText":"B-tree, B + -tree"},{"level":5,"text":"Features","anchor":"features-1","htmlText":"Features"},{"level":5,"text":"Application","anchor":"application-1","htmlText":"Application"},{"level":5,"text":"the difference","anchor":"the-difference-1","htmlText":"the difference"},{"level":5,"text":"Advantages of B-tree","anchor":"advantages-of-b-tree","htmlText":"Advantages of B-tree"},{"level":5,"text":"Advantages of B + trees","anchor":"advantages-of-b--trees","htmlText":"Advantages of B + trees"},{"level":4,"text":"Octree","anchor":"octree","htmlText":"Octree"},{"level":5,"text":"Purpose","anchor":"purpose","htmlText":"Purpose"},{"level":2,"text":"⚡️ Algorithm","anchor":"️-algorithm","htmlText":"⚡️ Algorithm"},{"level":3,"text":"Sort","anchor":"sort","htmlText":"Sort"},{"level":3,"text":"Find","anchor":"find","htmlText":"Find"},{"level":3,"text":"Graph search algorithm","anchor":"graph-search-algorithm","htmlText":"Graph search algorithm"},{"level":3,"text":"Other algorithms","anchor":"other-algorithms","htmlText":"Other algorithms"},{"level":2,"text":"❓ Problems","anchor":"-problems","htmlText":"❓ Problems"},{"level":3,"text":"Single Problem","anchor":"single-problem","htmlText":"Single Problem"},{"level":3,"text":"Leetcode Problems","anchor":"leetcode-problems","htmlText":"Leetcode Problems"},{"level":3,"text":"Sword Finger Offer","anchor":"sword-finger-offer","htmlText":"Sword Finger Offer"},{"level":3,"text":"Cracking the Coding Interview (Programmer Interview Gold)","anchor":"cracking-the-coding-interview-programmer-interview-gold","htmlText":"Cracking the Coding Interview (Programmer Interview Gold)"},{"level":3,"text":"Niu Ke","anchor":"niu-ke","htmlText":"Niu Ke"},{"level":2,"text":"💻 Operating system","anchor":"-operating-system","htmlText":"💻 Operating system"},{"level":3,"text":"Processes and threads","anchor":"processes-and-threads","htmlText":"Processes and threads"},{"level":4,"text":"Communication between processes and advantages and disadvantages","anchor":"communication-between-processes-and-advantages-and-disadvantages","htmlText":"Communication between processes and advantages and disadvantages"},{"level":4,"text":"Communication between threads","anchor":"communication-between-threads","htmlText":"Communication between threads"},{"level":4,"text":"Private and shared resources between processes","anchor":"private-and-shared-resources-between-processes","htmlText":"Private and shared resources between processes"},{"level":4,"text":"Private and shared resources between threads","anchor":"private-and-shared-resources-between-threads","htmlText":"Private and shared resources between threads"},{"level":4,"text":"Comparison, advantages and disadvantages of multi-process and multi-thread","anchor":"comparison-advantages-and-disadvantages-of-multi-process-and-multi-thread","htmlText":"Comparison, advantages and disadvantages of multi-process and multi-thread"},{"level":5,"text":"Compared","anchor":"compared","htmlText":"Compared"},{"level":5,"text":"Pros and cons","anchor":"pros-and-cons","htmlText":"Pros and cons"},{"level":5,"text":"Select","anchor":"select","htmlText":"Select"},{"level":3,"text":"Linux kernel synchronization","anchor":"linux-kernel-synchronization","htmlText":"Linux kernel synchronization"},{"level":4,"text":"the reason","anchor":"the-reason","htmlText":"the reason"},{"level":4,"text":"Synchronously","anchor":"synchronously","htmlText":"Synchronously"},{"level":3,"text":"Deadlock","anchor":"deadlock","htmlText":"Deadlock"},{"level":4,"text":"Reasons","anchor":"reasons","htmlText":"Reasons"},{"level":4,"text":"Generate conditions","anchor":"generate-conditions","htmlText":"Generate conditions"},{"level":4,"text":"Prevention","anchor":"prevention","htmlText":"Prevention"},{"level":3,"text":"File system","anchor":"file-system","htmlText":"File system"},{"level":3,"text":"Host byte order and network byte order","anchor":"host-byte-order-and-network-byte-order","htmlText":"Host byte order and network byte order"},{"level":4,"text":"Host Endianness (CPU Endianness)","anchor":"host-endianness-cpu-endianness","htmlText":"Host Endianness (CPU Endianness)"},{"level":5,"text":"Concept","anchor":"concept-2","htmlText":"Concept"},{"level":5,"text":"Storage method","anchor":"storage-method","htmlText":"Storage method"},{"level":5,"text":"Judging big-endian little-endian","anchor":"judging-big-endian-little-endian","htmlText":"Judging big-endian little-endian"},{"level":5,"text":"Byte order of each architecture processor","anchor":"byte-order-of-each-architecture-processor","htmlText":"Byte order of each architecture processor"},{"level":4,"text":"Network byte order","anchor":"network-byte-order","htmlText":"Network byte order"},{"level":3,"text":"Page replacement algorithm","anchor":"page-replacement-algorithm","htmlText":"Page replacement algorithm"},{"level":4,"text":"Categories","anchor":"categories-1","htmlText":"Categories"},{"level":4,"text":"Algorithm","anchor":"algorithm","htmlText":"Algorithm"},{"level":2,"text":"☁️ Computer Network","anchor":"️-computer-network","htmlText":"☁️ Computer Network"},{"level":3,"text":"Roles and protocols of each layer","anchor":"roles-and-protocols-of-each-layer","htmlText":"Roles and protocols of each layer"},{"level":3,"text":"Physical layer","anchor":"physical-layer","htmlText":"Physical layer"},{"level":3,"text":"data link layer","anchor":"data-link-layer","htmlText":"data link layer"},{"level":4,"text":"Point-to-point channel","anchor":"point-to-point-channel","htmlText":"Point-to-point channel"},{"level":4,"text":"Broadcast Channel","anchor":"broadcast-channel","htmlText":"Broadcast Channel"},{"level":3,"text":"Network layer","anchor":"network-layer","htmlText":"Network layer"},{"level":4,"text":"IP Internet Protocol","anchor":"ip-internet-protocol","htmlText":"IP Internet Protocol"},{"level":4,"text":"ICMP Internet Control Message Protocol","anchor":"icmp-internet-control-message-protocol","htmlText":"ICMP Internet Control Message Protocol"},{"level":4,"text":"Interior Gateway Protocol","anchor":"interior-gateway-protocol","htmlText":"Interior Gateway Protocol"},{"level":4,"text":"External gateway protocol","anchor":"external-gateway-protocol","htmlText":"External gateway protocol"},{"level":4,"text":"IP multicast","anchor":"ip-multicast","htmlText":"IP multicast"},{"level":4,"text":"VPN and NAT","anchor":"vpn-and-nat","htmlText":"VPN and NAT"},{"level":4,"text":"What does the routing table contain?","anchor":"what-does-the-routing-table-contain","htmlText":"What does the routing table contain?"},{"level":3,"text":"Transport layer","anchor":"transport-layer","htmlText":"Transport layer"},{"level":4,"text":"TCP","anchor":"tcp","htmlText":"TCP"},{"level":4,"text":"UDP","anchor":"udp","htmlText":"UDP"},{"level":4,"text":"Difference between TCP and UDP","anchor":"difference-between-tcp-and-udp","htmlText":"Difference between TCP and UDP"},{"level":4,"text":"TCP Sticky Packet","anchor":"tcp-sticky-packet","htmlText":"TCP Sticky Packet"},{"level":5,"text":"the reason","anchor":"the-reason-1","htmlText":"the reason"},{"level":5,"text":"Solve","anchor":"solve","htmlText":"Solve"},{"level":4,"text":"TCP Flow Control","anchor":"tcp-flow-control","htmlText":"TCP Flow Control"},{"level":5,"text":"Concept","anchor":"concept-3","htmlText":"Concept"},{"level":5,"text":"Methods","anchor":"methods","htmlText":"Methods"},{"level":4,"text":"TCP congestion control","anchor":"tcp-congestion-control","htmlText":"TCP congestion control"},{"level":5,"text":"Concept","anchor":"concept-4","htmlText":"Concept"},{"level":5,"text":"Methods","anchor":"methods-1","htmlText":"Methods"},{"level":4,"text":"TCP Transmission connection management","anchor":"tcp-transmission-connection-management","htmlText":"TCP Transmission connection management"},{"level":5,"text":"TCP 三次握手建立连接","anchor":"tcp-三次握手建立连接","htmlText":"TCP 三次握手建立连接"},{"level":5,"text":"Why does TCP have to shake hands three times?","anchor":"why-does-tcp-have-to-shake-hands-three-times","htmlText":"Why does TCP have to shake hands three times?"},{"level":5,"text":"TCP Four waves to release the connection","anchor":"tcp-four-waves-to-release-the-connection","htmlText":"TCP Four waves to release the connection"},{"level":5,"text":"Why does TCP have to wave four times?","anchor":"why-does-tcp-have-to-wave-four-times","htmlText":"Why does TCP have to wave four times?"},{"level":4,"text":"TCP finite state machine","anchor":"tcp-finite-state-machine","htmlText":"TCP finite state machine"},{"level":3,"text":"Application layer","anchor":"application-layer","htmlText":"Application layer"},{"level":4,"text":"DNS","anchor":"dns","htmlText":"DNS"},{"level":4,"text":"FTP","anchor":"ftp","htmlText":"FTP"},{"level":4,"text":"TELNET","anchor":"telnet","htmlText":"TELNET"},{"level":4,"text":"WWW","anchor":"www","htmlText":"WWW"},{"level":5,"text":"URL","anchor":"url","htmlText":"URL"},{"level":5,"text":"HTTP","anchor":"http","htmlText":"HTTP"},{"level":5,"text":"Other agreements","anchor":"other-agreements","htmlText":"Other agreements"},{"level":2,"text":"🌩 Network Programming","anchor":"-network-programming","htmlText":"🌩 Network Programming"},{"level":3,"text":"Socket","anchor":"socket","htmlText":"Socket"},{"level":4,"text":"Socket middle read()、write() function","anchor":"socket-middle-readwrite-function","htmlText":"Socket middle read()、write() function"},{"level":5,"text":"read()","anchor":"read","htmlText":"read()"},{"level":5,"text":"write ()","anchor":"write-","htmlText":"write ()"},{"level":4,"text":"TCP three-way handshake in socket to establish connection","anchor":"tcp-three-way-handshake-in-socket-to-establish-connection","htmlText":"TCP three-way handshake in socket to establish connection"},{"level":4,"text":"TCP four-way handshake in socket to release connection","anchor":"tcp-four-way-handshake-in-socket-to-release-connection","htmlText":"TCP four-way handshake in socket to release connection"},{"level":2,"text":"💾 Database","anchor":"-database","htmlText":"💾 Database"},{"level":3,"text":"basic concepts","anchor":"basic-concepts","htmlText":"basic concepts"},{"level":3,"text":"Common data models","anchor":"common-data-models","htmlText":"Common data models"},{"level":3,"text":"Common SQL Operations","anchor":"common-sql-operations","htmlText":"Common SQL Operations"},{"level":3,"text":"Relational Database","anchor":"relational-database","htmlText":"Relational Database"},{"level":4,"text":"Index","anchor":"index","htmlText":"Index"},{"level":3,"text":"Database integrity","anchor":"database-integrity","htmlText":"Database integrity"},{"level":3,"text":"Relational data theory","anchor":"relational-data-theory","htmlText":"Relational data theory"},{"level":4,"text":"Paradigm","anchor":"paradigm","htmlText":"Paradigm"},{"level":3,"text":"Database Recovery","anchor":"database-recovery","htmlText":"Database Recovery"},{"level":3,"text":"Concurrency control","anchor":"concurrency-control","htmlText":"Concurrency control"},{"level":2,"text":"📏 Design pattern","anchor":"-design-pattern","htmlText":"📏 Design pattern"},{"level":3,"text":"Singleton mode","anchor":"singleton-mode","htmlText":"Singleton mode"},{"level":3,"text":"Abstract factory pattern","anchor":"abstract-factory-pattern","htmlText":"Abstract factory pattern"},{"level":3,"text":"Adapter Mode","anchor":"adapter-mode","htmlText":"Adapter Mode"},{"level":3,"text":"Bridge mode","anchor":"bridge-mode","htmlText":"Bridge mode"},{"level":3,"text":"Observer mode","anchor":"observer-mode","htmlText":"Observer mode"},{"level":3,"text":"Six Principles of Design Patterns","anchor":"six-principles-of-design-patterns","htmlText":"Six Principles of Design Patterns"},{"level":2,"text":"⚙️ Link Loading Library","anchor":"️-link-loading-library","htmlText":"⚙️ Link Loading Library"},{"level":3,"text":"memory, stack, heap","anchor":"memory-stack-heap","htmlText":"memory, stack, heap"},{"level":4,"text":"stack","anchor":"stack","htmlText":"stack"},{"level":4,"text":"Heap","anchor":"heap","htmlText":"Heap"},{"level":4,"text":"\"Segment fault\" or \"Illegal operation, this memory address cannot be read / write\"","anchor":"segment-fault-or-illegal-operation-this-memory-address-cannot-be-read--write","htmlText":"\"Segment fault\" or \"Illegal operation, this memory address cannot be read / write\""},{"level":3,"text":"Compile and link","anchor":"compile-and-link","htmlText":"Compile and link"},{"level":4,"text":"File formats for each platform","anchor":"file-formats-for-each-platform","htmlText":"File formats for each platform"},{"level":4,"text":"Compile and link process","anchor":"compile-and-link-process","htmlText":"Compile and link process"},{"level":4,"text":"target document","anchor":"target-document","htmlText":"target document"},{"level":5,"text":"Object file format","anchor":"object-file-format","htmlText":"Object file format"},{"level":5,"text":"Object file storage structure","anchor":"object-file-storage-structure","htmlText":"Object file storage structure"},{"level":4,"text":"Linked Interface-Symbol","anchor":"linked-interface-symbol","htmlText":"Linked Interface-Symbol"},{"level":3,"text":"Shared Library for Linux","anchor":"shared-library-for-linux","htmlText":"Shared Library for Linux"},{"level":4,"text":"Name","anchor":"name","htmlText":"Name"},{"level":4,"text":"path","anchor":"path","htmlText":"path"},{"level":4,"text":"Environment variables","anchor":"environment-variables","htmlText":"Environment variables"},{"level":4,"text":"So shared library writing","anchor":"so-shared-library-writing","htmlText":"So shared library writing"},{"level":4,"text":"use of so shared library (called by executable project)","anchor":"use-of-so-shared-library-called-by-executable-project","htmlText":"use of so shared library (called by executable project)"},{"level":3,"text":"Windows Application entry function","anchor":"windows-application-entry-function","htmlText":"Windows Application entry function"},{"level":3,"text":"Dynamic-Link Library for Windows","anchor":"dynamic-link-library-for-windows","htmlText":"Dynamic-Link Library for Windows"},{"level":4,"text":"Uses","anchor":"uses","htmlText":"Uses"},{"level":4,"text":"Note","anchor":"note","htmlText":"Note"},{"level":4,"text":"Search order for loading Windows programs","anchor":"search-order-for-loading-windows-programs","htmlText":"Search order for loading Windows programs"},{"level":4,"text":"DLL Entry function","anchor":"dll-entry-function","htmlText":"DLL Entry function"},{"level":4,"text":"Load and unload library","anchor":"load-and-unload-library","htmlText":"Load and unload library"},{"level":4,"text":"Display link to export symbol","anchor":"display-link-to-export-symbol","htmlText":"Display link to export symbol"},{"level":4,"text":"DumpBin.exe View DLL information","anchor":"dumpbinexe-view-dll-information","htmlText":"DumpBin.exe View DLL information"},{"level":4,"text":"Flow chart of LoadLibrary and FreeLibrary","anchor":"flow-chart-of-loadlibrary-and-freelibrary","htmlText":"Flow chart of LoadLibrary and FreeLibrary"},{"level":5,"text":"LoadLibrary","anchor":"loadlibrary","htmlText":"LoadLibrary"},{"level":5,"text":"FreeLibrary","anchor":"freelibrary","htmlText":"FreeLibrary"},{"level":4,"text":"Writing of DLL library (export a DLL module)","anchor":"writing-of-dll-library-export-a-dll-module","htmlText":"Writing of DLL library (export a DLL module)"},{"level":4,"text":"Use of DLL library (dynamic link DLL at runtime)","anchor":"use-of-dll-library-dynamic-link-dll-at-runtime","htmlText":"Use of DLL library (dynamic link DLL at runtime)"},{"level":3,"text":"Runtime(Runtime Library)","anchor":"runtimeruntime-library","htmlText":"Runtime(Runtime Library)"},{"level":4,"text":"Typical program operation steps","anchor":"typical-program-operation-steps","htmlText":"Typical program operation steps"},{"level":4,"text":"glibc entry","anchor":"glibc-entry","htmlText":"glibc entry"},{"level":4,"text":"MSVC CRT Entry","anchor":"msvc-crt-entry","htmlText":"MSVC CRT Entry"},{"level":4,"text":"C Language Runtime (CRT)","anchor":"c-language-runtime-crt","htmlText":"C Language Runtime (CRT)"},{"level":4,"text":"C Language Standard Library (ANSI C)","anchor":"c-language-standard-library-ansi-c","htmlText":"C Language Standard Library (ANSI C)"},{"level":2,"text":"📚 Books","anchor":"-books","htmlText":"📚 Books"},{"level":3,"text":"Language","anchor":"language","htmlText":"Language"},{"level":3,"text":"Algorithm","anchor":"algorithm-1","htmlText":"Algorithm"},{"level":3,"text":"System","anchor":"system","htmlText":"System"},{"level":3,"text":"The internet","anchor":"the-internet","htmlText":"The internet"},{"level":3,"text":"Other","anchor":"other-1","htmlText":"Other"},{"level":2,"text":"🔱 C / C ++ Development Direction","anchor":"-c--c--development-direction","htmlText":"🔱 C / C ++ Development Direction"},{"level":3,"text":"Backend / Server","anchor":"backend--server","htmlText":"Backend / Server"},{"level":3,"text":"Desktop Client","anchor":"desktop-client","htmlText":"Desktop Client"},{"level":3,"text":"Graphics / Game / VR / AR","anchor":"graphics--game--vr--ar","htmlText":"Graphics / Game / VR / AR"},{"level":3,"text":"Test Development","anchor":"test-development","htmlText":"Test Development"},{"level":3,"text":"Cyber Security / Reverse","anchor":"cyber-security--reverse","htmlText":"Cyber Security / Reverse"},{"level":3,"text":"Embedded / IoT","anchor":"embedded--iot","htmlText":"Embedded / IoT"},{"level":3,"text":"Audio / Video / Streaming / SDK","anchor":"audio--video--streaming--sdk","htmlText":"Audio / Video / Streaming / SDK"},{"level":3,"text":"Computer Vision / Machine Learning","anchor":"computer-vision--machine-learning","htmlText":"Computer Vision / Machine Learning"},{"level":2,"text":"💯 Review brush question website","anchor":"-review-brush-question-website","htmlText":"💯 Review brush question website"},{"level":2,"text":"📝 Interview Question Experience","anchor":"-interview-question-experience","htmlText":"📝 Interview Question Experience"},{"level":2,"text":"📆 Recruiting time posts","anchor":"-recruiting-time-posts","htmlText":"📆 Recruiting time posts"},{"level":2,"text":"👍 Recommend","anchor":"-recommend","htmlText":"👍 Recommend"},{"level":2,"text":"👬 Contributor","anchor":"-contributor","htmlText":"👬 Contributor"},{"level":2,"text":"📜 License","anchor":"-license","htmlText":"📜 License"}],"lineInfo":{"truncatedLoc":"3443","truncatedSloc":"2430"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Markdown","languageID":222,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/huihut/interview/blob/master/README_en.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/huihut/interview/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/huihut/interview/raw/refs/heads/master/README_en.md","renderImageOrRaw":false,"richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv align=\"center\" dir=\"auto\"\u003e\n📖 Github\n | \n\u003ca href=\"https://interview.huihut.com\" rel=\"nofollow\"\u003e📚 Docsify\u003c/a\u003e\n\u003c/div\u003e \n\u003cbr\u003e\n\u003cdiv align=\"center\" dir=\"auto\"\u003e\n\u003ca href=\"https://github.com/huihut/interview/\"\u003e简体中文\u003c/a\u003e\n | \nEnglish\n\u003c/div\u003e \n\u003cbr\u003e\n\u003cp dir=\"auto\"\u003e\u003cb\u003e\u003c/b\u003e\u003c/p\u003e\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e💡 ON\u003c/b\u003e\u003c/summary\u003e\u003cp dir=\"auto\"\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e📚 This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C / C ++ technology, including language, program library, data structure, algorithm, system, network, link loading library and other knowledge and interview experience, recruitment, internal push, etc. information.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e💡 Side directory support methods:\u003ca href=\"https://interview.huihut.com\" rel=\"nofollow\"\u003e📚 Docsify Doc\u003c/a\u003e、\u003ca href=\"https://github.com/jawil/GayHub\"\u003eGithub + TOC navigation\u003c/a\u003e(\u003ca href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TOC%E9%A2%84%E8%A7%88.png\" rel=\"nofollow\"\u003eTOC preview.png\u003c/a\u003e)\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e📄 Save as PDF: Use the Chrome browser to open the \u003ca href=\"https://interview.huihut.com\" rel=\"nofollow\"\u003e 📚 Docsify document \u003c/a\u003e page, shrink the left directory-right click-print-select the target printer is Save as PDF-Save ( \u003ca href=\"https://raw.githubusercontent.com/huihut/interview/master/images/PrintPreview.png\" rel=\"nofollow\"\u003ePrint Preview.png\u003c/a\u003e )\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e🙏 If there are any errors or improvements in the contents of the warehouse, issues or pr are welcome. Suggestions or discussions can be submitted at \u003ca href=\"https://github.com/huihut/interview/issues/12\" data-hovercard-type=\"issue\" data-hovercard-url=\"/huihut/interview/issues/12/hovercard\"\u003e# 12\u003c/a\u003e. Due to my limited level, the knowledge points in the warehouse are from my original, reading notes, books, blog posts, etc. Non-original has been marked with the source, if there is any omission, please issue an issue. This warehouse follows the \u003ca href=\"https://github.com/huihut/interview/blob/master/LICENSE\"\u003eCC BY-NC-SA 4.0\u003c/a\u003e agreement, please indicate the source for the reprint, and may not be used for commercial purposes.\u003c/p\u003e\n\u003c/details\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e📑 Table of contents\u003c/h2\u003e\u003ca id=\"user-content--table-of-contents\" class=\"anchor\" aria-label=\"Permalink: 📑 Table of contents\" href=\"#-table-of-contents\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"#cc\"\u003e➕ C/C++\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#effective\"\u003e⭐️ Effective\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#stl\"\u003e📦 STL\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#data-structure\"\u003e〽️ Data Structure\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#algorithm\"\u003e⚡️ Algorithm\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#problems\"\u003e❓ Problems\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#os\"\u003e💻 OS\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#computer-network\"\u003e☁️ Computer Network\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#network-programming\"\u003e🌩 Network Programming\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#database\"\u003e💾 Database\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#design-pattern\"\u003e📏 Design Pattern\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#link-loading-library\"\u003e⚙️ Link Loading Library\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#books\"\u003e📚 Books\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#cc-development-direction\"\u003e🔱 C/C++ development direction\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#review-of-brush-questions-website\"\u003e💯 Review of Brush Questions Website\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#interview-questions-experience\"\u003e📝 Interview Questions Experience\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#recruitment-time-post\"\u003e📆 Recruitment time post\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#recommend\"\u003e👍 Recommend\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#contributor\"\u003e👬 Contributor\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"#license\"\u003e📜 License\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-cc\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e➕ C/C++\u003c/h2\u003e\u003ca id=\"user-content--cc\" class=\"anchor\" aria-label=\"Permalink: ➕ C/C++\" href=\"#-cc\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003econst\u003c/h3\u003e\u003ca id=\"user-content-const\" class=\"anchor\" aria-label=\"Permalink: const\" href=\"#const\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFunction\u003c/h4\u003e\u003ca id=\"user-content-function\" class=\"anchor\" aria-label=\"Permalink: Function\" href=\"#function\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eModify the variable, indicating that the variable cannot be changed;\u003c/li\u003e\n\u003cli\u003eModified pointers, divided into pointers to const (pointer to const) and pointers that are constants themselves (const pointer, const pointer);\u003c/li\u003e\n\u003cli\u003eModified references, references to constants (reference to const), are used for formal parameter types, which avoids copying and function modification of values;\u003c/li\u003e\n\u003cli\u003eDecorate a member function, stating that member variables cannot be modified within the member function.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003econst Pointers and references\u003c/h4\u003e\u003ca id=\"user-content-const-pointers-and-references\" class=\"anchor\" aria-label=\"Permalink: const Pointers and references\" href=\"#const-pointers-and-references\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePointer\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePointer to const\u003c/li\u003e\n\u003cli\u003eA pointer to a constant itself (const pointer)\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eReference\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eReference to const\u003c/li\u003e\n\u003cli\u003eThere is no const reference because the reference is an alias of an object, the reference is not an object\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e(Think of it for convenience) The value modified by const (after const) cannot be changed, such as \u003ccode\u003ep2\u003c/code\u003e, \u003ccode\u003ep3\u003c/code\u003e in the usage example below\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003euse\u003c/h4\u003e\u003ca id=\"user-content-use\" class=\"anchor\" aria-label=\"Permalink: use\" href=\"#use\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003econst use\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// class\nclass A\n{\nprivate:\n const int a; // constant object member, can use initialization list or in-class initializer\n\npublic:\n // Constructor\n A() : a(0) { };\n A(int x) : a(x) { }; // initialize list\n\n // const can be used to distinguish between overloaded functions\n int getValue(); // ordinary member function\n int getValue() const; // constant member function, must not modify the value of any data member in the class\n};\n\nvoid function()\n{\n // object\n A b; // ordinary object, can call all member functions\n const A a; // constant object, can only call constant member functions\n const A *p = \u0026amp;a; // pointer variable, point to a constant object\n const A \u0026amp;q = a; // reference to constant object\n\n // pointer\n char greeting[] = \u0026quot;Hello\u0026quot;;\n char* p1 = greeting; // pointer variable, pointing to a character array variable\n const char* p2 = greeting; // pointer variable, pointing to a character array constant (char followed by const, indicating that the character pointed to (char) cannot be changed)\n char* const p3 = greeting; // itself is a constant pointer to a character array variable (const followed by p3, indicating that the p3 pointer itself cannot be changed)\n const char* const p4 = greeting; // a pointer to a constant itself, pointing to a character array constant\n}\n\n// function\nvoid function1(const int Var); // the passed parameters are immutable within the function\nvoid function2(const char* Var); // The content pointed to by the parameter pointer is constant\nvoid function3(char* const Var); // parameter pointer is constant\nvoid function4(const int\u0026amp; Var); // the reference parameter is constant inside the function\n\n// function return value\nconst int function5(); // returns a constant\nconst int* function6(); // returns a pointer variable to a constant, use: const int * p = function6 ();\nint* const function7(); // returns a constant pointer to a variable, use: int * const p = function7 ();\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e class\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003eprivate:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e a; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e constant object member, can use initialization list or in-class initializer\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Constructor\u003c/span\u003e\n \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e() : a(\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e) { };\n \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e x) : a(x) { }; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e initialize list\u003c/span\u003e\n\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e const can be used to distinguish between overloaded functions\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003egetValue\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e ordinary member function\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003egetValue\u003c/span\u003e() \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e constant member function, must not modify the value of any data member in the class\u003c/span\u003e\n};\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunction\u003c/span\u003e()\n{\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e object\u003c/span\u003e\n A b; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e ordinary object, can call all member functions\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e A a; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e constant object, can only call constant member functions\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e A *p = \u0026amp;a; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e pointer variable, point to a constant object\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e A \u0026amp;q = a; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e reference to constant object\u003c/span\u003e\n\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e pointer\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e greeting[] = \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eHello\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e* p1 = greeting; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e pointer variable, pointing to a character array variable\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e* p2 = greeting; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e pointer variable, pointing to a character array constant (char followed by const, indicating that the character pointed to (char) cannot be changed)\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e* \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e p3 = greeting; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e itself is a constant pointer to a character array variable (const followed by p3, indicating that the p3 pointer itself cannot be changed)\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e* \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e p4 = greeting; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e a pointer to a constant itself, pointing to a character array constant\u003c/span\u003e\n}\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e function\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunction1\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e Var); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e the passed parameters are immutable within the function\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunction2\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e* Var); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e The content pointed to by the parameter pointer is constant\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunction3\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e* \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e Var); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e parameter pointer is constant\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunction4\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e\u0026amp; Var); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e the reference parameter is constant inside the function\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e function return value\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunction5\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e returns a constant\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e* \u003cspan class=\"pl-en\"\u003efunction6\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e returns a pointer variable to a constant, use: const int * p = function6 ();\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e* \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunction7\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e returns a constant pointer to a variable, use: int * const p = function7 ();\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e#define and const constants\u003c/h4\u003e\u003ca id=\"user-content-define-and-const-constants\" class=\"anchor\" aria-label=\"Permalink: #define and const constants\" href=\"#define-and-const-constants\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003e#define\u003c/th\u003e\n\u003cth\u003econst constants\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eMacro definitions, equivalent to character substitution\u003c/td\u003e\n\u003ctd\u003econstant declarations\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003epreprocessor processing\u003c/td\u003e\n\u003ctd\u003ecompiler processing\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ewithout type safety checking\u003c/td\u003e\n\u003ctd\u003ewith type safety checking\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eno memory allocation\u003c/td\u003e\n\u003ctd\u003ememory allocation required\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003estored in code segment\u003c/td\u003e\n\u003ctd\u003estored in data segment\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCan be canceled by \u003ccode\u003e#undef\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eNot cancelable\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003estatic\u003c/h3\u003e\u003ca id=\"user-content-static\" class=\"anchor\" aria-label=\"Permalink: static\" href=\"#static\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFunction\u003c/h4\u003e\u003ca id=\"user-content-function-1\" class=\"anchor\" aria-label=\"Permalink: Function\" href=\"#function-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eModify ordinary variables, modify the storage area and life cycle of the variables, make the variables stored in the static area, allocate space before the \u003ccode\u003emain\u003c/code\u003e function runs, if there is an initial value, initialize it with the initial value, if there is no initial value, the system uses the default Value to initialize it.\u003c/li\u003e\n\u003cli\u003eModify ordinary functions to indicate the scope of the function, which can only be used in the file where the function is defined. When developing a project with multiple people, in order to prevent duplicate names from functions in other people's namespaces, you can position functions as static.\u003c/li\u003e\n\u003cli\u003eDecorate member variables. Decorate member variables so that all objects hold only one of the variable, and you can access the member without generating an object.\u003c/li\u003e\n\u003cli\u003eDecorate member functions. Decorate member functions so that they can be accessed without generating objects, but non-static members cannot be accessed within static functions.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ethis pointer\u003c/h3\u003e\u003ca id=\"user-content-this-pointer\" class=\"anchor\" aria-label=\"Permalink: this pointer\" href=\"#this-pointer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003ethis\u003c/code\u003e pointer is a special pointer hidden in every non-static member function. It points to the object that called the member function.\u003c/li\u003e\n\u003cli\u003eWhen calling a member function on an object, the compiler first assigns the address of the object to the \u003ccode\u003ethis\u003c/code\u003e pointer, and then calls the member function. Each time the member function accesses a data member, the \u003ccode\u003ethis\u003c/code\u003e pointer is implicitly used.\u003c/li\u003e\n\u003cli\u003eWhen a member function is called, it is automatically passed an implicit parameter, which is a pointer to the object where the member function is located.\u003c/li\u003e\n\u003cli\u003eThe \u003ccode\u003ethis\u003c/code\u003e pointer is implicitly declared as: \u003ccode\u003eClassName * const this\u003c/code\u003e, which means that the \u003ccode\u003ethis\u003c/code\u003e pointer cannot be assigned; in the \u003ccode\u003econst\u003c/code\u003e member function of the \u003ccode\u003eClassName\u003c/code\u003e class, the type of the \u003ccode\u003ethis\u003c/code\u003e pointer For: \u003ccode\u003econst ClassName * const\u003c/code\u003e, this means that the object pointed to by the \u003ccode\u003ethis\u003c/code\u003e pointer cannot be modified (that is, the data members of such objects cannot be assigned);\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003ethis\u003c/code\u003e is not a regular variable, but an rvalue, so you cannot get the address of \u003ccode\u003ethis\u003c/code\u003e (you can't \u003ccode\u003e\u0026amp; this\u003c/code\u003e).\u003c/li\u003e\n\u003cli\u003eIt is often necessary to explicitly reference the \u003ccode\u003ethis\u003c/code\u003e pointer in the following scenarios:\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eTo implement a chained reference to an object;\u003c/li\u003e\n\u003cli\u003eTo avoid performing assignments on the same object;\u003c/li\u003e\n\u003cli\u003eWhen implementing some data structures, such as \u003ccode\u003elist\u003c/code\u003e.\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003einline function\u003c/h3\u003e\u003ca id=\"user-content-inline-function\" class=\"anchor\" aria-label=\"Permalink: inline function\" href=\"#inline-function\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFeatures\u003c/h4\u003e\u003ca id=\"user-content-features\" class=\"anchor\" aria-label=\"Permalink: Features\" href=\"#features\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eEquivalent to writing the contents of the inline function at the call of the inline function;\u003c/li\u003e\n\u003cli\u003eIt is equivalent to directly execute the function body without executing the steps of entering the function;\u003c/li\u003e\n\u003cli\u003eEquivalent to a macro, but with more type checking than a macro, it really has function characteristics;\u003c/li\u003e\n\u003cli\u003eThe compiler generally does not inline inline functions that include complex operations such as loops, recursion, and switch;\u003c/li\u003e\n\u003cli\u003eFunctions defined in class declarations, other than virtual functions, are automatically implicitly treated as inline functions.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003euse\u003c/h4\u003e\u003ca id=\"user-content-use-1\" class=\"anchor\" aria-label=\"Permalink: use\" href=\"#use-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003einline use\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// Statement 1 (plus inline, recommended)\ninline int functionName(int first, int second,...);\n\n// statement 2 (without inline)\nint functionName(int first, int second,...);\n\n// definition\ninline int functionName(int first, int second,...) {/****/};\n\n// inside class definition, implicitly inline\nclass A {\n int doA() { return 0; } // implicit inlining\n}\n\n// definition outside the class, need to be explicitly inlined\nclass A {\n int doA();\n}\ninline int A::doA() { return 0; } // requires explicit inlining\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Statement 1 (plus inline, recommended)\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003einline\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunctionName\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e first, \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e second,...);\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e statement 2 (without inline)\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunctionName\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e first, \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e second,...);\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e definition\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003einline\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efunctionName\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e first, \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e second,...) {\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e/*\u003c/span\u003e**\u003cspan class=\"pl-c\"\u003e*/\u003c/span\u003e\u003c/span\u003e};\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e inside class definition, implicitly inline\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e {\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003edoA\u003c/span\u003e() { \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e; } \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e implicit inlining\u003c/span\u003e\n}\u003cspan class=\"pl-ii\"\u003e\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e definition outside the class, need to be explicitly inlined\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e {\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003edoA\u003c/span\u003e();\n}\u003cspan class=\"pl-ii\"\u003e\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003einline\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA::doA\u003c/span\u003e() { \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e; } \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e requires explicit inlining\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCompiler processing steps for inline functions\u003c/h4\u003e\u003ca id=\"user-content-compiler-processing-steps-for-inline-functions\" class=\"anchor\" aria-label=\"Permalink: Compiler processing steps for inline functions\" href=\"#compiler-processing-steps-for-inline-functions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eCopy the inline function body to the \u003ccode\u003einline\u003c/code\u003e function call point;\u003c/li\u003e\n\u003cli\u003eAllocate memory space for local variables in the used \u003ccode\u003einline\u003c/code\u003e function;\u003c/li\u003e\n\u003cli\u003eMap the input parameters and return values of the \u003ccode\u003einline\u003c/code\u003e function to the local variable space of the calling method;\u003c/li\u003e\n\u003cli\u003eIf the \u003ccode\u003einline\u003c/code\u003e function has multiple return points, turn it into a branch at the end of the inline function code block (using \u003ccode\u003eGOTO\u003c/code\u003e).\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAdvantages and disadvantages\u003c/h4\u003e\u003ca id=\"user-content-advantages-and-disadvantages\" class=\"anchor\" aria-label=\"Permalink: Advantages and disadvantages\" href=\"#advantages-and-disadvantages\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAdvantages\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eInline functions, like macro functions, perform code expansion at the callee's place, eliminating the need to push parameters on the stack, open and recover stack frames, and return results, etc., thereby improving program execution speed.\u003c/li\u003e\n\u003cli\u003eCompared to macro functions, inline functions do security checks or automatic type conversions (as with normal functions) when code is expanded, while macro definitions do not.\u003c/li\u003e\n\u003cli\u003eDeclaring a member function that is also defined in a class automatically converts it into an inline function, so inline functions can access class member variables, while macro definitions cannot.\u003c/li\u003e\n\u003cli\u003eInline functions are debuggable at runtime, while macro definitions are not.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003eDisadvantages\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eCode bloat. Inlining is at the expense of code bloat (copy), eliminating the overhead of function calls. If the time to execute the code in the function body is greater than the cost of the function call, then the efficiency gain will be small. On the other hand, copying the code for each inline function call will increase the total code size of the program and consume more memory space.\u003c/li\u003e\n\u003cli\u003eThe inline function cannot be upgraded with the function library upgrade. Changes to the inline function require recompilation, unlike non-inline, which can be linked directly.\u003c/li\u003e\n\u003cli\u003eWhether it is inline or not is beyond the programmer's control. Inline functions are just suggestions to the compiler. The decision whether to inline functions is up to the compiler.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCan a virtual function be an inline function?\u003c/h4\u003e\u003ca id=\"user-content-can-a-virtual-function-be-an-inline-function\" class=\"anchor\" aria-label=\"Permalink: Can a virtual function be an inline function?\" href=\"#can-a-virtual-function-be-an-inline-function\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"Http://www.cs.technion.ac.il/users/yechiel/c++-faq/inline-virtuals.html\" rel=\"nofollow\"\u003eAre \"inline virtual\" member functions ever actually \"inlined\"?\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eA virtual function can be an inline function. Inline can modify a virtual function, but it cannot be inlined when the virtual function exhibits polymorphism.\u003c/li\u003e\n\u003cli\u003eInlining is recommended by the compiler, and the polymorphism of virtual functions is at runtime. The compiler cannot know which code is called at runtime, so virtual functions cannot be inlined at runtime (runtime). .\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003einline virtual\u003c/code\u003e The only time it can be inlined is: the compiler knows which class the object is called (such as \u003ccode\u003eBase::who()\u003c/code\u003e ), only if the compiler has an actual object instead of a pointer or reference to the object Will happen.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eVirtual function inline use\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#include \u0026lt;iostream\u0026gt; \nusing namespace std;\nclass Base\n{\npublic:\n\tinline virtual void who()\n\t{\n\t\tcout \u0026lt;\u0026lt; \u0026quot;I am Base\\n\u0026quot;;\n\t}\n\tvirtual ~Base() {}\n};\nclass Derived : public Base\n{\npublic:\n\tinline void who() // Implicit inlining when not writing inline\n\t{\n\t\tcout \u0026lt;\u0026lt; \u0026quot;I am Derived\\n\u0026quot;;\n\t}\n};\n\nint main()\n{\n\t// The virtual function who () here is called through the concrete object (b) of the class (Base), which can be determined during compilation, so it can be inlined, but whether it is inlined depends on the compilation Device.\n\tBase b;\n\tb.who();\n\n\t// The virtual function here is called through a pointer, which is polymorphic and needs to be determined during runtime, so it cannot be inlined.\n\tBase *ptr = new Derived();\n\tptr-\u0026gt;who();\n\n\t// Because Base has a virtual destructor (virtual ~ Base () {}), when deleting, the Derived destructor is called first, and then the Base destructor is called to prevent memory leaks.\n\tdelete ptr;\n\tptr = nullptr;\n\n\tsystem(\u0026quot;pause\u0026quot;);\n\treturn 0;\n} \"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eiostream\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e \n\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e \u003cspan class=\"pl-k\"\u003enamespace\u003c/span\u003e \u003cspan class=\"pl-en\"\u003estd\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e;\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eBase\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003einline\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ewho\u003c/span\u003e()\n\t{\n\t\tcout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eI am Base\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e;\n\t}\n\t\u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-en\"\u003e~Base\u003c/span\u003e() {}\n};\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eDerived\u003c/span\u003e : \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eBase\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003einline\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ewho\u003c/span\u003e() \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Implicit inlining when not writing inline\u003c/span\u003e\n\t{\n\t\tcout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eI am Derived\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e;\n\t}\n};\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e()\n{\n\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e The virtual function who () here is called through the concrete object (b) of the class (Base), which can be determined during compilation, so it can be inlined, but whether it is inlined depends on the compilation Device.\u003c/span\u003e\n\tBase b;\n\tb.\u003cspan class=\"pl-c1\"\u003ewho\u003c/span\u003e();\n\n\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e The virtual function here is called through a pointer, which is polymorphic and needs to be determined during runtime, so it cannot be inlined.\u003c/span\u003e\n\tBase *ptr = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eDerived\u003c/span\u003e();\n\tptr-\u0026gt;\u003cspan class=\"pl-c1\"\u003ewho\u003c/span\u003e();\n\n\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Because Base has a virtual destructor (virtual ~ Base () {}), when deleting, the Derived destructor is called first, and then the Base destructor is called to prevent memory leaks.\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003edelete\u003c/span\u003e ptr;\n\tptr = \u003cspan class=\"pl-c1\"\u003enullptr\u003c/span\u003e;\n\n\t\u003cspan class=\"pl-c1\"\u003esystem\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003epause\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e);\n\t\u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n} \u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003evolatile\u003c/h3\u003e\u003ca id=\"user-content-volatile\" class=\"anchor\" aria-label=\"Permalink: volatile\" href=\"#volatile\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"volatile int i = 10; \"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003evolatile\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e i = \u003cspan class=\"pl-c1\"\u003e10\u003c/span\u003e; \u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe volatile keyword is a type modifier, and the type variable declared with it indicates that it can be changed by some factors unknown to the compiler (operating system, hardware, other threads, etc.). So using volatile tells the compiler that such objects should not be optimized.\u003c/li\u003e\n\u003cli\u003eVariables declared by the volatile keyword must be fetched from memory each time they are accessed (variables that are not modified by volatile may be fetched from CPU registers due to compiler optimizations)\u003c/li\u003e\n\u003cli\u003econst can be volatile (such as a read-only status register)\u003c/li\u003e\n\u003cli\u003ePointer can be volatile\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eassert()\u003c/h3\u003e\u003ca id=\"user-content-assert\" class=\"anchor\" aria-label=\"Permalink: assert()\" href=\"#assert\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAssertions are macros, not functions. The prototype of the assert macro is defined in \u003ccode\u003e\u0026lt;assert.h\u0026gt;\u003c/code\u003e (C), \u003ccode\u003e\u0026lt;cassert\u0026gt;\u003c/code\u003e (C ++), and its role is to terminate program execution if its condition returns an error. You can turn off assert by defining \u003ccode\u003eNDEBUG\u003c/code\u003e, but it needs to be at the beginning of the source code, before \u003ccode\u003einclude \u0026lt;assert.h\u0026gt;\u003c/code\u003e .\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eassert () uses\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#define NDEBUG // Add this line, assert is not available\n#include \u0026lt;assert.h\u0026gt;\n\nassert( p != NULL ); // assert is not available\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003edefine\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eNDEBUG\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Add this line, assert is not available\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eassert.h\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n\n\u003cspan class=\"pl-en\"\u003eassert\u003c/span\u003e( p != \u003cspan class=\"pl-c1\"\u003eNULL\u003c/span\u003e ); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e assert is not available\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003esizeof()\u003c/h3\u003e\u003ca id=\"user-content-sizeof\" class=\"anchor\" aria-label=\"Permalink: sizeof()\" href=\"#sizeof\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003esizeof For arrays - get the size of the entire array.\u003c/li\u003e\n\u003cli\u003esizeof For pointers - get the size of the space occupied by the pointer itself.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e#pragma pack(n)\u003c/h3\u003e\u003ca id=\"user-content-pragma-packn\" class=\"anchor\" aria-label=\"Permalink: #pragma pack(n)\" href=\"#pragma-packn\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eSet structure, union, and class member variables to be n-byte aligned\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e#pragma pack (n) use\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#pragma pack(push) // save alignment state\n#pragma pack(4) // Set to 4 byte alignment\n\nstruct test\n{\n char m1;\n double m4;\n int m3;\n};\n\n#pragma pack(pop) // Restore alignment\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003epragma\u003c/span\u003e pack(push) \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e save alignment state\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003epragma\u003c/span\u003e pack(4) \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Set to 4 byte alignment\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etest\u003c/span\u003e\n{\n \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e m1;\n \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e m4;\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e m3;\n};\n\n#\u003cspan class=\"pl-k\"\u003epragma\u003c/span\u003e pack(pop) \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Restore alignment\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBit field\u003c/h3\u003e\u003ca id=\"user-content-bit-field\" class=\"anchor\" aria-label=\"Permalink: Bit field\" href=\"#bit-field\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"Bit mode: 2; // mode is 2 digits\"\u003e\u003cpre\u003eBit mode: \u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e mode is 2 digits\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eA class can define its (non-static) data members as bit-fields, which contain a certain number of binary bits in a bit-field. When a program needs to transfer binary data to other programs or hardware devices, the bit field is usually used.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe layout of the bit field in memory is machine-dependent\u003c/li\u003e\n\u003cli\u003eThe type of the bit field must be an integer or enumerated type. The behavior of the bit field in a signed type will depend on the implementation.\u003c/li\u003e\n\u003cli\u003eThe fetch operator (\u0026amp;) cannot be applied to the bit field, and no pointer can point to the bit field of the class\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eextern \"C\"\u003c/h3\u003e\u003ca id=\"user-content-extern-c\" class=\"anchor\" aria-label=\"Permalink: extern \u0026quot;C\u0026quot;\" href=\"#extern-c\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eExtern-qualified functions or variables are of type extern\u003c/li\u003e\n\u003cli\u003eVariables and functions decorated with \u003ccode\u003eextern\" C \"\u003c/code\u003e are compiled and linked in C\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eThe function of \u003ccode\u003eextern\" C \"\u003c/code\u003e is to let the C ++ compiler treat the code declared by \u003ccode\u003eextern\" C \"\u003c/code\u003e as C language code, which can avoid the problem that the code cannot be linked with the symbols in the C language library due to symbol modification. .\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eextern \"C\" demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#ifdef __cplusplus\nextern \u0026quot;C\u0026quot; {\n#endif\n\nvoid *memset(void *, int, size_t);\n\n#ifdef __cplusplus\n}\n#endif\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003eifdef\u003c/span\u003e __cplusplus\n\u003cspan class=\"pl-k\"\u003eextern\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eC\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e {\n#endif\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e *\u003cspan class=\"pl-en\"\u003ememset\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e *, \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003esize_t\u003c/span\u003e);\n\n#\u003cspan class=\"pl-k\"\u003eifdef\u003c/span\u003e __cplusplus\n}\n#\u003cspan class=\"pl-k\"\u003eendif\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003estruct with typedef struct\u003c/h3\u003e\u003ca id=\"user-content-struct-with-typedef-struct\" class=\"anchor\" aria-label=\"Permalink: struct with typedef struct\" href=\"#struct-with-typedef-struct\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eIn C\u003c/h4\u003e\u003ca id=\"user-content-in-c\" class=\"anchor\" aria-label=\"Permalink: In C\" href=\"#in-c\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-c notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// c\ntypedef struct Student {\n int age; \n} S;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e// c\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eStudent\u003c/span\u003e {\n \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eage\u003c/span\u003e; \n} \u003cspan class=\"pl-smi\"\u003eS\u003c/span\u003e;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eEquivalent to\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// c\nstruct Student { \n int age; \n};\n\ntypedef struct Student S;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e// c\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eStudent\u003c/span\u003e { \n \u003cspan class=\"pl-smi\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eage\u003c/span\u003e; \n};\n\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eStudent\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eS\u003c/span\u003e;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAt this time \u003ccode\u003eS\u003c/code\u003e is equivalent to\u003ccode\u003e struct Student\u003c/code\u003e, but the two identifier namespaces are different.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eYou can also define \u003ccode\u003evoid Student(){}\u003c/code\u003e that does not conflict with \u003ccode\u003estruct Student\u003c/code\u003e .\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eIn C++\u003c/h4\u003e\u003ca id=\"user-content-in-c-1\" class=\"anchor\" aria-label=\"Permalink: In C++\" href=\"#in-c-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBecause the compiler's rules for positioning symbols (search rules) have changed, it is different from the C language.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eFirst, if \u003ccode\u003estruct Student {...};\u003c/code\u003e is defined in the class identifier space, when \u003ccode\u003eStudent me;\u003c/code\u003e is used, the compiler will search the global identifier table. If \u003ccode\u003eStudent\u003c/code\u003e is not found, it will be in the class identifier. search for.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThat means it can use \u003ccode\u003eStudent\u003c/code\u003e or \u003ccode\u003estruct Student\u003c/code\u003e, as follows:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// cpp\nstruct Student { \n int age; \n};\n\nvoid f( Student me ); // correct, the \u0026quot;struct\u0026quot; keyword can be omitted\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e cpp\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eStudent\u003c/span\u003e { \n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e age; \n};\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ef\u003c/span\u003e( Student me ); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e correct, the \"struct\" keyword can be omitted\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIf a function with the same name as \u003ccode\u003eStudent\u003c/code\u003e is defined, \u003ccode\u003eStudent\u003c/code\u003e only represents the function, not the structure, as follows:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"typedef struct Student { \n int age; \n} S;\n\nvoid Student() {} //Correct, \u0026quot;Student\u0026quot; only represents this function after definition\n\n//void S() {} // Error, symbol \u0026quot;S\u0026quot; has been defined as an alias for \u0026quot;struct Student\u0026quot;\n\nint main() {\n Student(); \n struct Student me; // Or \u0026quot;S me\u0026quot;;\n return 0;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eStudent\u003c/span\u003e { \n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e age; \n} S;\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eStudent\u003c/span\u003e() {} \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003eCorrect, \"Student\" only represents this function after definition\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003evoid S() {} // Error, symbol \"S\" has been defined as an alias for \"struct Student\"\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e() {\n \u003cspan class=\"pl-c1\"\u003eStudent\u003c/span\u003e(); \n \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eStudent\u003c/span\u003e me; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Or \"S me\";\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003estruct and class in C ++\u003c/h3\u003e\u003ca id=\"user-content-struct-and-class-in-c-\" class=\"anchor\" aria-label=\"Permalink: struct and class in C ++\" href=\"#struct-and-class-in-c-\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn general, struct is more suitable as an implementation of a data structure, and class is more suitable as an implementation of an object.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eThe difference\u003c/h4\u003e\u003ca id=\"user-content-the-difference\" class=\"anchor\" aria-label=\"Permalink: The difference\" href=\"#the-difference\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe most essential difference is the default access control\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eDefault inherited access rights. struct is public and class is private.\u003c/li\u003e\n\u003cli\u003estruct as the data structure implementation body, its default data access control is public, and class as the object implementation body, its default member variable access control is private.\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eunion union\u003c/h3\u003e\u003ca id=\"user-content-union-union\" class=\"anchor\" aria-label=\"Permalink: union union\" href=\"#union-union\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eUnion is a special class that saves space. A union can have multiple data members, but only one data member can have a value at any time. When a member is assigned, other members become undefined. Union has the following characteristics:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe default access control character is public\u003c/li\u003e\n\u003cli\u003eMay contain constructors and destructors\u003c/li\u003e\n\u003cli\u003eCannot contain members of reference type\u003c/li\u003e\n\u003cli\u003eCannot inherit from other classes and cannot be used as a base class\u003c/li\u003e\n\u003cli\u003eCannot contain virtual functions\u003c/li\u003e\n\u003cli\u003eAnonymous union can directly access union members in the scope where it is defined\u003c/li\u003e\n\u003cli\u003eAnonymous union cannot contain protected members or private members\u003c/li\u003e\n\u003cli\u003eGlobal anonymous union must be static\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eunion demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#include\u0026lt;iostream\u0026gt;\n\nunion UnionTest {\n UnionTest() : i(10) {};\n int i;\n double d;\n};\n\nstatic union {\n int i;\n double d;\n};\n\nint main() {\n UnionTest u;\n\n union {\n int i;\n double d;\n };\n\n std::cout \u0026lt;\u0026lt; u.i \u0026lt;\u0026lt; std::endl; // Output UnionTest union 10\n\n ::i = 20;\n std::cout \u0026lt;\u0026lt; ::i \u0026lt;\u0026lt; std::endl; // Output global static anonymous union 20\n\n i = 30;\n std::cout \u0026lt;\u0026lt; i \u0026lt;\u0026lt; std::endl; // Output of locally anonymous union of 30\n\n return 0;\n}\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eiostream\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003eunion\u003c/span\u003e UnionTest {\n \u003cspan class=\"pl-c1\"\u003eUnionTest\u003c/span\u003e() : \u003cspan class=\"pl-c1\"\u003ei\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e10\u003c/span\u003e) {};\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e i;\n \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e d;\n};\n\n\u003cspan class=\"pl-k\"\u003estatic\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eunion\u003c/span\u003e {\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e i;\n \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e d;\n};\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e() {\n UnionTest u;\n\n \u003cspan class=\"pl-k\"\u003eunion\u003c/span\u003e {\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e i;\n \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e d;\n };\n\n std::cout \u0026lt;\u0026lt; u.\u003cspan class=\"pl-smi\"\u003ei\u003c/span\u003e \u0026lt;\u0026lt; std::endl; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Output UnionTest union 10\u003c/span\u003e\n\n ::i = \u003cspan class=\"pl-c1\"\u003e20\u003c/span\u003e;\n std::cout \u0026lt;\u0026lt; ::i \u0026lt;\u0026lt; std::endl; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Output global static anonymous union 20\u003c/span\u003e\n\n i = \u003cspan class=\"pl-c1\"\u003e30\u003c/span\u003e;\n std::cout \u0026lt;\u0026lt; i \u0026lt;\u0026lt; std::endl; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Output of locally anonymous union of 30\u003c/span\u003e\n\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eC implements C ++ classes\u003c/h3\u003e\u003ca id=\"user-content-c-implements-c--classes\" class=\"anchor\" aria-label=\"Permalink: C implements C ++ classes\" href=\"#c-implements-c--classes\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eC implements object-oriented features of C ++ (encapsulation, inheritance, polymorphism)\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eEncapsulation: Use function pointers to encapsulate properties and methods into structures\u003c/li\u003e\n\u003cli\u003eInheritance: structure nesting\u003c/li\u003e\n\u003cli\u003ePolymorphism: function pointers of parent and child methods are different\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://stackoverflow.com/a/351745\" rel=\"nofollow\"\u003eCan you write object-oriented code in C? [closed]\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eexplicit (keyword)\u003c/h3\u003e\u003ca id=\"user-content-explicit-keyword\" class=\"anchor\" aria-label=\"Permalink: explicit (keyword)\" href=\"#explicit-keyword\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eexplicit constructor modification prevents implicit conversion and copy initialization\u003c/li\u003e\n\u003cli\u003eexplicit conversions can prevent implicit conversions, except \u003ca href=\"https://en.cppreference.com/w/cpp/language/implicit_conversion\" rel=\"nofollow\"\u003econversion by context\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eexplicit demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"struct A\n{\n\tA(int) { }\n\toperator bool() const { return true; }\n};\n\nstruct B\n{\n\texplicit B(int) {}\n\texplicit operator bool() const { return true; }\n};\n\nvoid doA(A a) {}\n\nvoid doB(B b) {}\n\nint main()\n{\n\tA a1(1);\t\t// OK:direct initialization\n\tA a2 = 1;\t\t// OK:copy initialization\n\tA a3{ 1 };\t\t// OK:direct list initialization\n\tA a4 = { 1 };\t\t// OK:copy list initialization\n\tA a5 = (A)1;\t\t// OK:Allow explicit conversion of static_cast\n\tdoA(1);\t\t\t// OK:Allow implicit conversion from int to A\n\tif (a1);\t\t// OK: implicit conversion from A to bool using conversion function A ::operator bool()\n\tbool a6(a1);\t\t// OK: implicit conversion from A to bool using conversion function A::operator bool()\n\tbool a7 = a1;\t\t// OK: implicit conversion from A to bool using conversion function A::operator bool()\n\tbool a8 = static_cast\u0026lt;bool\u0026gt;(a1); // OK: static_cast for direct initialization\n\n\tB b1(1);\t\t// OK:direct initialization\n\tB b2 = 1;\t\t// Error: Object modified by explicit constructor cannot be initialized by copying\n\tB b3{ 1 };\t\t// OK:direct list initialization\n\tB b4 = { 1 };\t\t// Error: Object modified by explicit constructor cannot copy list initialization\n\tB b5 = (B)1;\t\t// OK: Allow explicit conversion of static_cast\n\tdoB(1);\t\t\t// Error: Objects whose constructor is explicitly modified cannot be implicitly converted from int to B\n\tif (b1);\t\t// OK: objects modified by explicit conversion function B::operator bool() can be converted from B to bool by context\n\tbool b6(b1);\t\t// OK: Explicitly modified conversion function B::operator The object of bool() can be converted from B to bool by context\n\tbool b7 = b1;\t\t// Error: Objects modified by explicit conversion function B :: operator bool () cannot be implicitly converted\n\tbool b8 = static_cast\u0026lt;bool\u0026gt;(b1); // OK: static_cast performs direct initialization\n\n\treturn 0;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e\n{\n\t\u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e) { }\n\t\u003cspan class=\"pl-k\"\u003eoperator\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ebool\u003c/span\u003e() \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e { \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003etrue\u003c/span\u003e; }\n};\n\n\u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eB\u003c/span\u003e\n{\n\t\u003cspan class=\"pl-k\"\u003eexplicit\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eB\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e) {}\n\t\u003cspan class=\"pl-k\"\u003eexplicit\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eoperator\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ebool\u003c/span\u003e() \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e { \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003etrue\u003c/span\u003e; }\n};\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003edoA\u003c/span\u003e(A a) {}\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003edoB\u003c/span\u003e(B b) {}\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e()\n{\n\tA \u003cspan class=\"pl-smi\"\u003ea1\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e);\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:direct initialization\u003c/span\u003e\n\tA a2 = \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:copy initialization\u003c/span\u003e\n\tA a3{ \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e };\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:direct list initialization\u003c/span\u003e\n\tA a4 = { \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e };\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:copy list initialization\u003c/span\u003e\n\tA a5 = (A)\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:Allow explicit conversion of static_cast\u003c/span\u003e\n\t\u003cspan class=\"pl-c1\"\u003edoA\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e);\t\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:Allow implicit conversion from int to A\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (a1);\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: implicit conversion from A to bool using conversion function A ::operator bool()\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003ea6\u003c/span\u003e(a1);\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: implicit conversion from A to bool using conversion function A::operator bool()\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e a7 = a1;\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: implicit conversion from A to bool using conversion function A::operator bool()\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e a8 = \u003cspan class=\"pl-k\"\u003estatic_cast\u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e\u0026gt;(a1); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: static_cast for direct initialization\u003c/span\u003e\n\n\tB \u003cspan class=\"pl-smi\"\u003eb1\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e);\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:direct initialization\u003c/span\u003e\n\tB b2 = \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Error: Object modified by explicit constructor cannot be initialized by copying\u003c/span\u003e\n\tB b3{ \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e };\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK:direct list initialization\u003c/span\u003e\n\tB b4 = { \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e };\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Error: Object modified by explicit constructor cannot copy list initialization\u003c/span\u003e\n\tB b5 = (B)\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: Allow explicit conversion of static_cast\u003c/span\u003e\n\t\u003cspan class=\"pl-c1\"\u003edoB\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e);\t\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Error: Objects whose constructor is explicitly modified cannot be implicitly converted from int to B\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (b1);\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: objects modified by explicit conversion function B::operator bool() can be converted from B to bool by context\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eb6\u003c/span\u003e(b1);\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: Explicitly modified conversion function B::operator The object of bool() can be converted from B to bool by context\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e b7 = b1;\t\t\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Error: Objects modified by explicit conversion function B :: operator bool () cannot be implicitly converted\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e b8 = \u003cspan class=\"pl-k\"\u003estatic_cast\u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e\u0026gt;(b1); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK: static_cast performs direct initialization\u003c/span\u003e\n\n\t\u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003efriend - friend class and friend function\u003c/h3\u003e\u003ca id=\"user-content-friend---friend-class-and-friend-function\" class=\"anchor\" aria-label=\"Permalink: friend - friend class and friend function\" href=\"#friend---friend-class-and-friend-function\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAccess to private members\u003c/li\u003e\n\u003cli\u003eDestruction of encapsulation\u003c/li\u003e\n\u003cli\u003eFriendship is not transitive\u003c/li\u003e\n\u003cli\u003eOne-way friendship\u003c/li\u003e\n\u003cli\u003eThere are no restrictions on the form and number of friend declarations\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eusing\u003c/h3\u003e\u003ca id=\"user-content-using\" class=\"anchor\" aria-label=\"Permalink: using\" href=\"#using\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eusing statement\u003c/h4\u003e\u003ca id=\"user-content-using-statement\" class=\"anchor\" aria-label=\"Permalink: using statement\" href=\"#using-statement\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eA \u003ccode\u003eusing declaration\u003c/code\u003e introduces only one member of a namespace at a time. It allows us to know exactly which name is referenced in the program. Such as:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"using namespace_name :: name;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e namespace_name :: name;\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUsing declaration of constructor\u003c/h4\u003e\u003ca id=\"user-content-using-declaration-of-constructor\" class=\"anchor\" aria-label=\"Permalink: Using declaration of constructor\" href=\"#using-declaration-of-constructor\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn C ++ 11, a derived class can reuse the constructor defined by its direct base class.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Derived : Base {\npublic:\n using Base::Base;\n /* ... */\n};\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eDerived\u003c/span\u003e : Base {\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e Base::Base;\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e/*\u003c/span\u003e ... \u003cspan class=\"pl-c\"\u003e*/\u003c/span\u003e\u003c/span\u003e\n};\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAs above using statement, for each constructor of the base class, the compiler generates a derived class constructor corresponding to it (the parameter list is exactly the same). Generates the following type constructor:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"Derived (parms): Base (args) {}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-en\"\u003eDerived\u003c/span\u003e (parms): Base (args) {}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eusing instructions\u003c/h4\u003e\u003ca id=\"user-content-using-instructions\" class=\"anchor\" aria-label=\"Permalink: using instructions\" href=\"#using-instructions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe \u003ccode\u003eusing directive\u003c/code\u003e makes all names in a particular namespace visible, so we don't need to add any prefix qualifiers to them. Such as:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"using namespace_name name;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e namespace_name name;\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMinimize \u003ccode\u003eusing directives\u003c/code\u003e to pollute namespaces\u003c/h4\u003e\u003ca id=\"user-content-minimize-using-directives-to-pollute-namespaces\" class=\"anchor\" aria-label=\"Permalink: Minimize using directives to pollute namespaces\" href=\"#minimize-using-directives-to-pollute-namespaces\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eGenerally speaking, it is safer to use the using command than the using compile command, because it** imports only the specified name**. If the name conflicts with a local name, the compiler will** issue instructions**. The using compile command imports all names, including names that may not be needed. If there is a conflict with a local name, the local name will override the namespace version, and the compiler will not issue a warning. In addition, the openness of the namespace means that the names of the namespace may be scattered in multiple places, which makes it difficult to know exactly which names have been added.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eusing demo\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eMinimize \u003ccode\u003eusing directives\u003c/code\u003e\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"using namespace std;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e \u003cspan class=\"pl-k\"\u003enamespace\u003c/span\u003e \u003cspan class=\"pl-en\"\u003estd\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e;\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eYou should use \u003ccode\u003eusing declarations\u003c/code\u003e more often\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"int x;\nstd::cin \u0026gt;\u0026gt; x ;\nstd::cout \u0026lt;\u0026lt; x \u0026lt;\u0026lt; std::endl;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e x;\nstd::cin \u0026gt;\u0026gt; x ;\nstd::cout \u0026lt;\u0026lt; x \u0026lt;\u0026lt; std::endl;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eor\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"using std::cin;\nusing std::cout;\nusing std::endl;\nint x;\ncin \u0026gt;\u0026gt; x;\ncout \u0026lt;\u0026lt; x \u0026lt;\u0026lt; endl;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e std::cin;\n\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e std::cout;\n\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e std::endl;\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e x;\ncin \u0026gt;\u0026gt; x;\ncout \u0026lt;\u0026lt; x \u0026lt;\u0026lt; endl;\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e:: scope resolution operator\u003c/h3\u003e\u003ca id=\"user-content--scope-resolution-operator\" class=\"anchor\" aria-label=\"Permalink: :: scope resolution operator\" href=\"#-scope-resolution-operator\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eclassification\u003c/h4\u003e\u003ca id=\"user-content-classification\" class=\"anchor\" aria-label=\"Permalink: classification\" href=\"#classification\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eGlobal scope (\u003ccode\u003e:: name\u003c/code\u003e): used before type names (classes, class members, member functions, variables, etc.) to indicate that the scope is a global namespace\u003c/li\u003e\n\u003cli\u003eClass scope character (\u003ccode\u003eclass :: name\u003c/code\u003e): used to indicate that the scope of the specified type is specific to a class\u003c/li\u003e\n\u003cli\u003eNamespace scope (\u003ccode\u003enamespace :: name\u003c/code\u003e): used to indicate that the scope of the specified type is specific to a namespace\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003e:: demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"int count = 11; // Global (: :) count\n\nclass A {\npublic:\n\tstatic int count; // Count (A::count) of class A\n};\nint A::count = 21;\n\nvoid fun()\n{\n\tint count = 31; // Initialize the local count to 31\n\tcount = 32; // Set the local count to 32\n}\n\nint main() {\n\t::count = 12; // Test 1: Set the global count to 12\n\n\tA::count = 22; // Test 2: Set the count of class A to 22\n\n\tfun();\t\t // Test 3\n\n\treturn 0;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e count = \u003cspan class=\"pl-c1\"\u003e11\u003c/span\u003e; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Global (: :) count\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e {\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n\t\u003cspan class=\"pl-k\"\u003estatic\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e count; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Count (A::count) of class A\u003c/span\u003e\n};\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e A::count = \u003cspan class=\"pl-c1\"\u003e21\u003c/span\u003e;\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efun\u003c/span\u003e()\n{\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e count = \u003cspan class=\"pl-c1\"\u003e31\u003c/span\u003e; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Initialize the local count to 31\u003c/span\u003e\n\tcount = \u003cspan class=\"pl-c1\"\u003e32\u003c/span\u003e; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Set the local count to 32\u003c/span\u003e\n}\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e() {\n\t::count = \u003cspan class=\"pl-c1\"\u003e12\u003c/span\u003e; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Test 1: Set the global count to 12\u003c/span\u003e\n\n\tA::count = \u003cspan class=\"pl-c1\"\u003e22\u003c/span\u003e; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Test 2: Set the count of class A to 22\u003c/span\u003e\n\n\t\u003cspan class=\"pl-c1\"\u003efun\u003c/span\u003e();\t\t \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Test 3\u003c/span\u003e\n\n\t\u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eenum - enum type\u003c/h3\u003e\u003ca id=\"user-content-enum---enum-type\" class=\"anchor\" aria-label=\"Permalink: enum - enum type\" href=\"#enum---enum-type\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eScoped Enumeration Type\u003c/h4\u003e\u003ca id=\"user-content-scoped-enumeration-type\" class=\"anchor\" aria-label=\"Permalink: Scoped Enumeration Type\" href=\"#scoped-enumeration-type\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"enum class open_modes { input, output, append };\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eenum\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eopen_modes\u003c/span\u003e { input, output, append };\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUnscoped enumeration type\u003c/h4\u003e\u003ca id=\"user-content-unscoped-enumeration-type\" class=\"anchor\" aria-label=\"Permalink: Unscoped enumeration type\" href=\"#unscoped-enumeration-type\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"enum color { red, yellow, green };\nenum { floatPrec = 6, doublePrec = 10 };\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eenum\u003c/span\u003e color { red, yellow, green };\n\u003cspan class=\"pl-k\"\u003eenum\u003c/span\u003e { floatPrec = \u003cspan class=\"pl-c1\"\u003e6\u003c/span\u003e, doublePrec = \u003cspan class=\"pl-c1\"\u003e10\u003c/span\u003e };\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003edecltype\u003c/h3\u003e\u003ca id=\"user-content-decltype\" class=\"anchor\" aria-label=\"Permalink: decltype\" href=\"#decltype\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003edecltype keyword is used to check the declared type or expression type and value classification of an entity. grammar:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"decltype ( expression )\"\u003e\u003cpre\u003e\u003cspan class=\"pl-en\"\u003edecltype\u003c/span\u003e ( expression )\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003edecltype demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// Tail return allows us to declare the return type after the parameter list\ntemplate \u0026lt;typename It\u0026gt;\nauto fcn(It beg, It end) -\u0026gt; decltype(*beg)\n{\n / process the sequence\n return *beg; // return a reference to an element in the sequence\n}\n// In order to use template parameter members, you must use typename\ntemplate \u0026lt;typename It\u0026gt;\nauto fcn2(It beg, It end) -\u0026gt; typename remove_reference\u0026lt;decltype(*beg)\u0026gt;::type\n{\n // process the sequence\n return * beg; // return a copy of an element in the sequence\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Tail return allows us to declare the return type after the parameter list\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etemplate \u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003etypename\u003c/span\u003e It\u0026gt;\n\u003cspan class=\"pl-k\"\u003eauto\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efcn\u003c/span\u003e(It beg, It end) -\u0026gt; decltype(*beg)\n{\n / process the sequence\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e *beg; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e return a reference to an element in the sequence\u003c/span\u003e\n}\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e In order to use template parameter members, you must use typename\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etemplate \u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003etypename\u003c/span\u003e It\u0026gt;\n\u003cspan class=\"pl-k\"\u003eauto\u003c/span\u003e \u003cspan class=\"pl-en\"\u003efcn2\u003c/span\u003e(It beg, It end) -\u0026gt; typename remove_reference\u0026lt;decltype(*beg)\u0026gt;::type\n{\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e process the sequence\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e * beg; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e return a copy of an element in the sequence\u003c/span\u003e\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ereference\u003c/h3\u003e\u003ca id=\"user-content-reference\" class=\"anchor\" aria-label=\"Permalink: reference\" href=\"#reference\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003elvalue reference\u003c/h4\u003e\u003ca id=\"user-content-lvalue-reference\" class=\"anchor\" aria-label=\"Permalink: lvalue reference\" href=\"#lvalue-reference\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eRegular reference, which generally represents the identity of the object.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ervalue reference\u003c/h4\u003e\u003ca id=\"user-content-rvalue-reference\" class=\"anchor\" aria-label=\"Permalink: rvalue reference\" href=\"#rvalue-reference\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAn rvalue reference is a reference that must be bound to an rvalue (a temporary object, an object to be destroyed) and generally represents the value of the object.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eAn rvalue reference implements Move Sementics and Perfect Forwarding. Its main purpose is twofold:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eEliminate unnecessary copying of objects when two objects interact, saving computing storage resources and improving efficiency.\u003c/li\u003e\n\u003cli\u003eAbility to define generic functions more concisely.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eReference Collapse\u003c/h4\u003e\u003ca id=\"user-content-reference-collapse\" class=\"anchor\" aria-label=\"Permalink: Reference Collapse\" href=\"#reference-collapse\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eX \u0026amp; \u0026amp;\u003c/code\u003e, \u003ccode\u003eX \u0026amp; \u0026amp;\u0026amp;\u003c/code\u003e, \u003ccode\u003eX \u0026amp;\u0026amp; \u0026amp;\u003c/code\u003e can be folded into \u003ccode\u003eX \u0026amp;\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eX \u0026amp;\u0026amp; \u0026amp;\u0026amp;\u003c/code\u003e can be folded into \u003ccode\u003eX \u0026amp;\u0026amp;\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMacro\u003c/h3\u003e\u003ca id=\"user-content-macro\" class=\"anchor\" aria-label=\"Permalink: Macro\" href=\"#macro\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eA macro definition can implement a function similar to a function, but it is not a function after all, and the \"parameters\" in the brackets in the macro definition are not real parameters. The \"parameters\" are replaced one-to-one when the macro is expanded .\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMember initialization list\u003c/h3\u003e\u003ca id=\"user-content-member-initialization-list\" class=\"anchor\" aria-label=\"Permalink: Member initialization list\" href=\"#member-initialization-list\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003ebenefit\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eMore efficient: There is no need to call the default constructor once.\u003c/li\u003e\n\u003cli\u003eIn some cases it is necessary to use the initialization list:\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eConstant members, because constants can only be initialized and cannot be assigned, so they must be placed in the initialization list\u003c/li\u003e\n\u003cli\u003eReference types. References must be initialized at the time of definition and cannot be reassigned, so they must also be written in the initialization list.\u003c/li\u003e\n\u003cli\u003eThere is no class type for the default constructor, because the initialization list can be used to initialize without having to call the default constructor.\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003einitializer_list list initialization\u003c/h3\u003e\u003ca id=\"user-content-initializer_list-list-initialization\" class=\"anchor\" aria-label=\"Permalink: initializer_list list initialization\" href=\"#initializer_list-list-initialization\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eInitialize an object with a curly brace initializer list, where the corresponding constructor accepts a \u003ccode\u003estd :: initializer_list\u003c/code\u003e parameter.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003einitializer_list uses\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#include \u0026lt;iostream\u0026gt;\n#include \u0026lt;vector\u0026gt;\n#include \u0026lt;initializer_list\u0026gt;\n \ntemplate \u0026lt;class T\u0026gt;\nstruct S {\n std::vector\u0026lt;T\u0026gt; v;\n S(std::initializer_list\u0026lt;T\u0026gt; l) : v(l) {\n std::cout \u0026lt;\u0026lt; \u0026quot;constructed with a \u0026quot; \u0026lt;\u0026lt; l.size() \u0026lt;\u0026lt; \u0026quot;-element list\\n\u0026quot;;\n }\n void append(std::initializer_list\u0026lt;T\u0026gt; l) {\n v.insert(v.end(), l.begin(), l.end());\n }\n std::pair\u0026lt;const T*, std::size_t\u0026gt; c_arr() const {\n return {\u0026amp;v[0], v.size()}; // Copy the list initialization in the return statement\n // this does not use std :: initializer_list\n }\n};\n \ntemplate \u0026lt;typename T\u0026gt;\nvoid templated_fn(T) {}\n \nint main()\n{\n S\u0026lt;int\u0026gt; s = {1, 2, 3, 4, 5}; // copy initialization\n s.append({6, 7, 8}); // list initialization in function call\n \n std::cout \u0026lt;\u0026lt; \u0026quot;The vector size is now \u0026quot; \u0026lt;\u0026lt; s.c_arr().second \u0026lt;\u0026lt; \u0026quot; ints:\\n\u0026quot;;\n \n for (auto n : s.v)\n std::cout \u0026lt;\u0026lt; n \u0026lt;\u0026lt; ' ';\n std::cout \u0026lt;\u0026lt; '\\n';\n \n std::cout \u0026lt;\u0026lt; \u0026quot;Range-for over brace-init-list: \\n\u0026quot;;\n \n for (int x : {-1, -2, -3}) // auto rules make this band for work\n std::cout \u0026lt;\u0026lt; x \u0026lt;\u0026lt; ' ';\n std::cout \u0026lt;\u0026lt; '\\n';\n \n auto al = {10, 11, 12}; // special rules for auto\n \n std::cout \u0026lt;\u0026lt; \u0026quot;The list bound to auto has size() = \u0026quot; \u0026lt;\u0026lt; al.size() \u0026lt;\u0026lt; '\\n';\n \n// templated_fn({1, 2, 3}); // Compile error! \u0026quot;{1, 2, 3}\u0026quot; is not an expression,\n // it has no type, so T cannot infer\n templated_fn\u0026lt;std::initializer_list\u0026lt;int\u0026gt;\u0026gt;({1, 2, 3}); // OK\n templated_fn\u0026lt;std::vector\u0026lt;int\u0026gt;\u0026gt;({1, 2, 3}); // also OK\n}\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eiostream\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003evector\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003einitializer_list\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n \n\u003cspan class=\"pl-k\"\u003etemplate \u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eT\u003c/span\u003e\u0026gt;\n\u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eS\u003c/span\u003e {\n std::vector\u0026lt;T\u0026gt; v;\n \u003cspan class=\"pl-en\"\u003eS\u003c/span\u003e(std::initializer_list\u0026lt;T\u0026gt; l) : v(l) {\n std::cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003econstructed with a \u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; l.\u003cspan class=\"pl-c1\"\u003esize\u003c/span\u003e() \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e-element list\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e;\n }\n \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eappend\u003c/span\u003e(std::initializer_list\u0026lt;T\u0026gt; l) {\n v.\u003cspan class=\"pl-c1\"\u003einsert\u003c/span\u003e(v.\u003cspan class=\"pl-c1\"\u003eend\u003c/span\u003e(), l.\u003cspan class=\"pl-c1\"\u003ebegin\u003c/span\u003e(), l.\u003cspan class=\"pl-c1\"\u003eend\u003c/span\u003e());\n }\n std::pair\u0026lt;\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e T*, std::\u003cspan class=\"pl-c1\"\u003esize_t\u003c/span\u003e\u0026gt; \u003cspan class=\"pl-en\"\u003ec_arr\u003c/span\u003e() \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e {\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e {\u0026amp;v[\u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e], v.\u003cspan class=\"pl-c1\"\u003esize\u003c/span\u003e()}; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Copy the list initialization in the return statement\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e this does not use std :: initializer_list\u003c/span\u003e\n }\n};\n \n\u003cspan class=\"pl-k\"\u003etemplate \u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003etypename\u003c/span\u003e T\u0026gt;\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etemplated_fn\u003c/span\u003e(T) {}\n \n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e()\n{\n S\u0026lt;\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e\u0026gt; s = {\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e3\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e4\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e5\u003c/span\u003e}; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e copy initialization\u003c/span\u003e\n s.\u003cspan class=\"pl-c1\"\u003eappend\u003c/span\u003e({\u003cspan class=\"pl-c1\"\u003e6\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e7\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e8\u003c/span\u003e}); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e list initialization in function call\u003c/span\u003e\n \n std::cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eThe vector size is now \u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; s.\u003cspan class=\"pl-c1\"\u003ec_arr\u003c/span\u003e().\u003cspan class=\"pl-smi\"\u003esecond\u003c/span\u003e \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e ints:\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e;\n \n \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e (\u003cspan class=\"pl-k\"\u003eauto\u003c/span\u003e n : s.\u003cspan class=\"pl-smi\"\u003ev\u003c/span\u003e)\n std::cout \u0026lt;\u0026lt; n \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e \u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003e;\n std::cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003e;\n \n std::cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eRange-for over brace-init-list: \u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e;\n \n \u003cspan class=\"pl-k\"\u003efor\u003c/span\u003e (\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e x : {-\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e, -\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, -\u003cspan class=\"pl-c1\"\u003e3\u003c/span\u003e}) \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e auto rules make this band for work\u003c/span\u003e\n std::cout \u0026lt;\u0026lt; x \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e \u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003e;\n std::cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003e;\n \n \u003cspan class=\"pl-k\"\u003eauto\u003c/span\u003e al = {\u003cspan class=\"pl-c1\"\u003e10\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e11\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e12\u003c/span\u003e}; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e special rules for auto\u003c/span\u003e\n \n std::cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eThe list bound to auto has size() = \u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; al.\u003cspan class=\"pl-c1\"\u003esize\u003c/span\u003e() \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e'\u003c/span\u003e\u003c/span\u003e;\n \n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e templated_fn({1, 2, 3}); // Compile error! \"{1, 2, 3}\" is not an expression,\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e it has no type, so T cannot infer\u003c/span\u003e\n templated_fn\u0026lt;std::initializer_list\u0026lt;\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e\u0026gt;\u0026gt;({\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e3\u003c/span\u003e}); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e OK\u003c/span\u003e\n templated_fn\u0026lt;std::vector\u0026lt;\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e\u0026gt;\u0026gt;({\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e3\u003c/span\u003e}); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e also OK\u003c/span\u003e\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eObject-oriented\u003c/h3\u003e\u003ca id=\"user-content-object-oriented\" class=\"anchor\" aria-label=\"Permalink: Object-oriented\" href=\"#object-oriented\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eObject-oriented programming (OOP) is a model of program programming with object concepts, and it is also an abstract approach to program development.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E5%9F%BA%E6%9C%AC%E7%89%B9%E5%BE%81.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E5%9F%BA%E6%9C%AC%E7%89%B9%E5%BE%81.png\" alt=\"Object-oriented features\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThree Object-Oriented Features-Encapsulation, Inheritance, and Polymorphism\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eEncapsulation\u003c/h3\u003e\u003ca id=\"user-content-encapsulation\" class=\"anchor\" aria-label=\"Permalink: Encapsulation\" href=\"#encapsulation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eEncapsulate objective things into abstract classes, and classes can only use their own data and methods for trusted classes or objects to operate, and hide untrusted information. Keywords: public, protected, private. Do not write defaults to private.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003epublic\u003c/code\u003e members: can be accessed by any entity\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eprotected\u003c/code\u003e members: only allowed to be accessed by subclasses and member functions of this class\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eprivate\u003c/code\u003e members: only accessible by member functions, friend classes, or friend functions of this class\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInheritance\u003c/h3\u003e\u003ca id=\"user-content-inheritance\" class=\"anchor\" aria-label=\"Permalink: Inheritance\" href=\"#inheritance\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBase class (parent class) ——\u0026gt; derived class (subclass)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePolymorphism\u003c/h3\u003e\u003ca id=\"user-content-polymorphism\" class=\"anchor\" aria-label=\"Permalink: Polymorphism\" href=\"#polymorphism\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePolymorphism, that is, multiple states (morphology). In simple terms, we can define polymorphism as the ability of a message to be displayed in multiple forms.\u003c/li\u003e\n\u003cli\u003ePolymorphism is based on encapsulation and inheritance.\u003c/li\u003e\n\u003cli\u003eC polymorphism classification and implementation:\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eAd-hoc Polymorphism (compile-time): function overload, operator overload\u003c/li\u003e\n\u003cli\u003eSubtype Polymorphism (runtime): virtual function\u003c/li\u003e\n\u003cli\u003eParametric Polymorphism (compile-time): class template, function template\u003c/li\u003e\n\u003cli\u003eCoercion Polymorphism (compilation / runtime): basic type conversion, custom type conversion\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://catonmat.net/cpp-polymorphism\" rel=\"nofollow\"\u003eThe Four Polymorphisms in C++\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eStatic polymorphism (compile time / early binding)\u003c/h4\u003e\u003ca id=\"user-content-static-polymorphism-compile-time--early-binding\" class=\"anchor\" aria-label=\"Permalink: Static polymorphism (compile time / early binding)\" href=\"#static-polymorphism-compile-time--early-binding\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFunction overloading\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class A\n{\npublic:\n void do(int a);\n void do(int a, int b);\n};\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edo\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e a);\n \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edo\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e a, \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e b);\n};\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDynamic polymorphism (runtime / late binding)\u003c/h4\u003e\u003ca id=\"user-content-dynamic-polymorphism-runtime--late-binding\" class=\"anchor\" aria-label=\"Permalink: Dynamic polymorphism (runtime / late binding)\" href=\"#dynamic-polymorphism-runtime--late-binding\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eVirtual functions: decorate member functions with virtual to make them virtual\u003c/li\u003e\n\u003cli\u003eDynamic binding: dynamic binding occurs when a virtual function is called using a reference or pointer to a base class\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003cstrong\u003enote:\u003c/strong\u003e\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eYou can assign an object of a derived class to a pointer or reference of the base class, and not vice versa\u003c/li\u003e\n\u003cli\u003eOrdinary functions (non-class member functions) cannot be virtual functions\u003c/li\u003e\n\u003cli\u003eStatic functions (static) cannot be virtual functions\u003c/li\u003e\n\u003cli\u003eThe constructor cannot be a virtual function (because when the constructor is called, the virtual table pointer is not in the object's memory space, the virtual table pointer must be formed after the constructor is called)\u003c/li\u003e\n\u003cli\u003eAn inline function cannot be a virtual function when it shows polymorphism. For an explanation, see: \u003ca href=\"https://github.com/huihut/interview#%E8%99%9A%E5%87%BD%E6%95%B0virtual%E5%8F%AF%E4%BB%A5%E6%98%AF%E5%86%85%E8%81%94%E5%87%BD%E6%95%B0inline%E5%90%97\"\u003eCan a virtual function be an inline function? \u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eDynamic polymorphic demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Shape // shape class\n{\npublic:\n virtual double calcArea()\n {\n ...\n }\n virtual ~Shape();\n};\nclass Circle : public Shape // circle class\n{\npublic:\n virtual double calcArea();\n ...\n};\nclass Rect : public Shape // rectangle class\n{\npublic:\n virtual double calcArea();\n ...\n};\nint main()\n{\n Shape * shape1 = new Circle(4.0);\n Shape * shape2 = new Rect(5.0, 6.0);\n shape1-\u0026gt;calcArea(); // call the method in the circular class\n shape2-\u0026gt;calcArea(); // call the method in the rectangle class\n delete shape1;\n shape1 = nullptr;\n delete shape2;\n shape2 = nullptr;\n return 0;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eShape\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e shape class\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecalcArea\u003c/span\u003e()\n {\n ...\n }\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-en\"\u003e~Shape\u003c/span\u003e();\n};\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eCircle\u003c/span\u003e : \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eShape\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e circle class\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecalcArea\u003c/span\u003e();\n ...\n};\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eRect\u003c/span\u003e : \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eShape\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e rectangle class\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecalcArea\u003c/span\u003e();\n ...\n};\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e()\n{\n Shape * shape1 = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eCircle\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e4.0\u003c/span\u003e);\n Shape * shape2 = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eRect\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e5.0\u003c/span\u003e, \u003cspan class=\"pl-c1\"\u003e6.0\u003c/span\u003e);\n shape1-\u0026gt;\u003cspan class=\"pl-c1\"\u003ecalcArea\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e call the method in the circular class\u003c/span\u003e\n shape2-\u0026gt;\u003cspan class=\"pl-c1\"\u003ecalcArea\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e call the method in the rectangle class\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003edelete\u003c/span\u003e shape1;\n shape1 = \u003cspan class=\"pl-c1\"\u003enullptr\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003edelete\u003c/span\u003e shape2;\n shape2 = \u003cspan class=\"pl-c1\"\u003enullptr\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eVirtual destructor\u003c/h3\u003e\u003ca id=\"user-content-virtual-destructor\" class=\"anchor\" aria-label=\"Permalink: Virtual destructor\" href=\"#virtual-destructor\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe virtual destructor is to resolve the pointer of the base class to the derived class object, and delete the derived class object with the pointer of the base class.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eVirtual destructor demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"class Shape\n{\npublic:\n Shape(); // Constructor cannot be virtual\n virtual double calcArea();\n virtual ~Shape(); // virtual destructor\n};\nclass Circle : public Shape // circle class\n{\npublic:\n virtual double calcArea();\n ...\n};\nint main()\n{\n Shape * shape1 = new Circle(4.0);\n shape1-\u0026gt;calcArea(); \n delete shape1; // Because Shape has a virtual destructor, when delete deletes the memory, it first calls the subclass destructor and then the base class destructor to prevent memory leaks.\n shape1 = NULL;\n return 0;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eShape\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-en\"\u003eShape\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Constructor cannot be virtual\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecalcArea\u003c/span\u003e();\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-en\"\u003e~Shape\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e virtual destructor\u003c/span\u003e\n};\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eCircle\u003c/span\u003e : \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eShape\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e circle class\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003edouble\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecalcArea\u003c/span\u003e();\n ...\n};\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e()\n{\n Shape * shape1 = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eCircle\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e4.0\u003c/span\u003e);\n shape1-\u0026gt;\u003cspan class=\"pl-c1\"\u003ecalcArea\u003c/span\u003e(); \n \u003cspan class=\"pl-k\"\u003edelete\u003c/span\u003e shape1; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Because Shape has a virtual destructor, when delete deletes the memory, it first calls the subclass destructor and then the base class destructor to prevent memory leaks.\u003c/span\u003e\n shape1 = \u003cspan class=\"pl-c1\"\u003eNULL\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePure virtual functions\u003c/h3\u003e\u003ca id=\"user-content-pure-virtual-functions\" class=\"anchor\" aria-label=\"Permalink: Pure virtual functions\" href=\"#pure-virtual-functions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eA pure virtual function is a special kind of virtual function. You cannot give a meaningful implementation to a virtual function in a base class. Instead, you declare it as a pure virtual function. Its implementation is left to the derived classes of the base class.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"virtual int A() = 0;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eA\u003c/span\u003e() = 0;\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eVirtual functions, pure virtual functions\u003c/h3\u003e\u003ca id=\"user-content-virtual-functions-pure-virtual-functions\" class=\"anchor\" aria-label=\"Permalink: Virtual functions, pure virtual functions\" href=\"#virtual-functions-pure-virtual-functions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eIf a virtual function is declared in the class, this function is implemented, even if it is empty, its role is to allow this function to be overridden in its subclasses, so that the compiler can use Late binding to achieve polymorphism. A pure virtual function is just an interface. It is a function declaration. It must be left in a subclass to implement it.\u003c/li\u003e\n\u003cli\u003eVirtual functions can not be overridden in subclasses; but pure virtual functions must be implemented in subclasses to instantiate subclasses.\u003c/li\u003e\n\u003cli\u003eThe virtual function class is used for \"implementation inheritance\". Inheriting the interface also inherits the implementation of the parent class. Pure virtual functions focus on the uniformity of the interface, and the implementation is done by subclasses.\u003c/li\u003e\n\u003cli\u003eA class with a pure virtual function is called an abstract class. This class cannot directly generate objects. It can only be used after being inherited and rewriting its virtual function. After an abstract class is inherited, subclasses can continue to be abstract or ordinary classes.\u003c/li\u003e\n\u003cli\u003eVirtual base class is the base class in virtual inheritance, see below for details.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://blog.csdn.net/u012260238/article/details/53610462\" rel=\"nofollow\"\u003eCSDN . C++ And connection of virtual functions and pure virtual functions\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eVirtual function pointer, virtual function table\u003c/h3\u003e\u003ca id=\"user-content-virtual-function-pointer-virtual-function-table\" class=\"anchor\" aria-label=\"Permalink: Virtual function pointer, virtual function table\" href=\"#virtual-function-pointer-virtual-function-table\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eVirtual function pointer: In an object containing a virtual function class, it points to a virtual function table, which is determined at runtime.\u003c/li\u003e\n\u003cli\u003eVirtual function table: in the program read-only data section (\u003ccode\u003e.rodata section\u003c/code\u003e, see: \u003ca href=\"#%E7%9B%AE%E6%A0%87%E6%96%87%E4%BB%B6%E5%AD%98%E5%82%A8%E7%BB%93%E6%9E%84\"\u003eobject file storage structure\u003c/a\u003e),Stores virtual function pointers. If the derived class implements a virtual function of the base class, the virtual function pointer of the original base class is overwritten in the virtual table, and is created according to the class declaration at compile time.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://blog.twofei.com/496/\" rel=\"nofollow\"\u003eC++ Function (table) implementation mechanism and simulation implementation in C language\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eVirtual inheritance\u003c/h3\u003e\u003ca id=\"user-content-virtual-inheritance\" class=\"anchor\" aria-label=\"Permalink: Virtual inheritance\" href=\"#virtual-inheritance\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eVirtual inheritance is used to solve the problem of diamond inheritance under multiple inheritance conditions (wasting storage space and ambiguity).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe underlying implementation principle is related to the compiler. It is generally implemented by ** virtual base class pointer ** and ** virtual base class table **. Each virtual inherited subclass has a virtual base class pointer (occupies the storage space of a pointer) , 4 bytes) and virtual base class table (does not occupy storage space of class objects) (It should be emphasized that the virtual base class will still have a copy in the subclass, but there is only one copy at most, not not in the subclass. Inside); when the subclass of virtual inheritance is inherited as the parent class, the pointer of the virtual base class will also be inherited.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIn fact, vbptr refers to a virtual base table pointer. This pointer points to a virtual base table. The virtual table records the offset address of the virtual base class and this class. Offset address, so that the virtual base class members are found, and virtual inheritance does not need to maintain two identical copies of the public base class (virtual base class) like ordinary multiple inheritance, saving storage space.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eVirtual inheritance, virtual functions\u003c/h3\u003e\u003ca id=\"user-content-virtual-inheritance-virtual-functions\" class=\"anchor\" aria-label=\"Permalink: Virtual inheritance, virtual functions\" href=\"#virtual-inheritance-virtual-functions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSimilarities: Both use virtual pointers (both occupy class storage space) and virtual tables (both do not occupy class storage space)\u003c/li\u003e\n\u003cli\u003ethe difference:\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eVirtual inheritance\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe virtual base class still exists in the inherited class and only takes up storage space\u003c/li\u003e\n\u003cli\u003eThe virtual base class table stores the offset of the virtual base class relative to the direct inherited class\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eVirtual function\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eVirtual functions do not take up storage space\u003c/li\u003e\n\u003cli\u003eThe virtual function table stores the virtual function address\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTemplate classes, member templates, virtual functions\u003c/h3\u003e\u003ca id=\"user-content-template-classes-member-templates-virtual-functions\" class=\"anchor\" aria-label=\"Permalink: Template classes, member templates, virtual functions\" href=\"#template-classes-member-templates-virtual-functions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eVirtual functions can be used in template classes\u003c/li\u003e\n\u003cli\u003eThe member template of a class (whether it is a normal class or a class template) (it is a member function of the template) cannot be a virtual function\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAbstract class, interface class, aggregate class\u003c/h3\u003e\u003ca id=\"user-content-abstract-class-interface-class-aggregate-class\" class=\"anchor\" aria-label=\"Permalink: Abstract class, interface class, aggregate class\" href=\"#abstract-class-interface-class-aggregate-class\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAbstract class: a class containing pure virtual functions\u003c/li\u003e\n\u003cli\u003eInterface class: Abstract class containing only pure virtual functions\u003c/li\u003e\n\u003cli\u003eAggregation classes: Users can directly access their members and have a special form of initialization syntax. Meet the following characteristics:\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAll members are public\u003c/li\u003e\n\u003cli\u003eNo constructor is defined\u003c/li\u003e\n\u003cli\u003eNo in-class initialization\u003c/li\u003e\n\u003cli\u003eNo base class, no virtual function\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMemory allocation and management\u003c/h3\u003e\u003ca id=\"user-content-memory-allocation-and-management\" class=\"anchor\" aria-label=\"Permalink: Memory allocation and management\" href=\"#memory-allocation-and-management\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003emalloc, calloc, realloc, alloca\u003c/h4\u003e\u003ca id=\"user-content-malloc-calloc-realloc-alloca\" class=\"anchor\" aria-label=\"Permalink: malloc, calloc, realloc, alloca\" href=\"#malloc-calloc-realloc-alloca\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003emalloc: apply for a specified number of bytes of memory. The initial value in the requested memory is uncertain.\u003c/li\u003e\n\u003cli\u003ecalloc: For an object of a specified length, allocate memory that can hold the specified number of objects. Each bit of the requested memory is initialized to 0.\u003c/li\u003e\n\u003cli\u003erealloc: change the previously allocated memory length (increase or decrease). When increasing the length, it may be necessary to move the contents of the previously allocated area to another sufficiently large area, while the initial value in the newly added area is uncertain.\u003c/li\u003e\n\u003cli\u003ealloca: apply for memory on the stack. When the program pops out of the stack, it will automatically release memory. However, it should be noted that alloca is not portable and difficult to implement on machines without traditional stacks. alloca should not be used in programs that must be widely ported. C99 supports variable-length arrays (VLAs) and can be used instead of alloca.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003emalloc, free\u003c/h4\u003e\u003ca id=\"user-content-malloc-free\" class=\"anchor\" aria-label=\"Permalink: malloc, free\" href=\"#malloc-free\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eUsed to allocate and release memory\u003c/p\u003e\n\u003cp dir=\"auto\"\u003emalloc, free use\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eApply for memory and confirm whether the application is successful\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"char *str = (char*) malloc(100);\nassert(str != nullptr);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e *str = (\u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e*) malloc(\u003cspan class=\"pl-c1\"\u003e100\u003c/span\u003e);\n\u003cspan class=\"pl-en\"\u003eassert\u003c/span\u003e(str != \u003cspan class=\"pl-c1\"\u003enullptr\u003c/span\u003e);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003ePointer is empty after freeing memory\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"free(p); \np = nullptr;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-en\"\u003efree\u003c/span\u003e(p); \np = \u003cspan class=\"pl-c1\"\u003enullptr\u003c/span\u003e;\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003enew、delete\u003c/h4\u003e\u003ca id=\"user-content-newdelete\" class=\"anchor\" aria-label=\"Permalink: new、delete\" href=\"#newdelete\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003enew / new []: Do two things, first call malloc at the bottom to allocate memory, and then call the constructor (create the object).\u003c/li\u003e\n\u003cli\u003edelete / delete []: also complete two things, first call the destructor (clean up resources), and then call free to free up space at the bottom.\u003c/li\u003e\n\u003cli\u003enew automatically calculates the number of bytes required when applying for memory, and malloc requires us to enter the number of bytes of the requested memory space ourselves.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003enew, delete demo\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eApply for memory and confirm whether the application is successful\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"int main()\n{\n T* t = new T(); // memory allocation first, then constructor\n delete t; // destructor first, then release memory\n return 0;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e()\n{\n T* t = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eT\u003c/span\u003e(); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e memory allocation first, then constructor\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003edelete\u003c/span\u003e t; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e destructor first, then release memory\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePositioning new\u003c/h4\u003e\u003ca id=\"user-content-positioning-new\" class=\"anchor\" aria-label=\"Permalink: Positioning new\" href=\"#positioning-new\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003ePositioning new (placement new) allows us to pass additional address parameters to new to create objects in a pre-specified memory area.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"new (place_address) type\nnew (place_address) type (initializers)\nnew (place_address) type [size]\nnew (place_address) type [size] { braced initializer list }\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e (place_address) type\n\u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e (place_address) type (initializers)\n\u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e (place_address) type [size]\n\u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e (place_address) type [size] { braced initializer list }\u003c/pre\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eplace_address\u003c/code\u003e is a pointer\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003einitializers\u003c/code\u003e provides a (possibly empty) comma-separated list of initial values\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003edelete this - Is it legal?\u003c/h3\u003e\u003ca id=\"user-content-delete-this---is-it-legal\" class=\"anchor\" aria-label=\"Permalink: delete this - Is it legal?\" href=\"#delete-this---is-it-legal\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://isocpp.org/wiki/faq/freestore-mgmt#delete-this\" rel=\"nofollow\"\u003eIs it legal (and moral) for a member function to say delete this?\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eLegal, but:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eIt must be guaranteed that this object is allocated via \u003ccode\u003enew\u003c/code\u003e (not \u003ccode\u003enew[]\u003c/code\u003e, not placement new, not on the stack, not global, not a member of other objects)\u003c/li\u003e\n\u003cli\u003eYou must ensure that the member function that calls delete this is the last member function that calls this\u003c/li\u003e\n\u003cli\u003eYou must ensure that the member function does not call this after \u003ccode\u003edelete this\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eMake sure no one uses it after delete this\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHow to define a class that can only generate objects on the heap (on the stack)?\u003c/h3\u003e\u003ca id=\"user-content-how-to-define-a-class-that-can-only-generate-objects-on-the-heap-on-the-stack\" class=\"anchor\" aria-label=\"Permalink: How to define a class that can only generate objects on the heap (on the stack)?\" href=\"#how-to-define-a-class-that-can-only-generate-objects-on-the-heap-on-the-stack\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://www.nowcoder.com/questionTerminal/0a584aa13f804f3ea72b442a065a7618\" rel=\"nofollow\"\u003eHow to define a class that can only generate objects on the heap (on the stack)?\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOnly on the heap\u003c/h4\u003e\u003ca id=\"user-content-only-on-the-heap\" class=\"anchor\" aria-label=\"Permalink: Only on the heap\" href=\"#only-on-the-heap\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eMethod: Make the destructor private\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eReason: C ++ is a static binding language. The compiler manages the life cycle of objects on the stack. When the compiler allocates stack space for class objects, it first checks the accessibility of the class's destructor. If the destructor is not accessible, the object cannot be created on the stack.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOnly on the stack\u003c/h4\u003e\u003ca id=\"user-content-only-on-the-stack\" class=\"anchor\" aria-label=\"Permalink: Only on the stack\" href=\"#only-on-the-stack\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eMethod: overload new and delete as private\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eReason: The object is generated on the heap using the new keyword operation. The process is divided into two stages: the first stage uses new to find available memory on the heap and allocates it to the object; the second stage calls the constructor to generate the object. By setting the new operation to private, the first phase cannot be completed, and objects cannot be generated on the heap.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSmart pointer\u003c/h3\u003e\u003ca id=\"user-content-smart-pointer\" class=\"anchor\" aria-label=\"Permalink: Smart pointer\" href=\"#smart-pointer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eIn the C ++ Standard Library (STL)\u003c/h4\u003e\u003ca id=\"user-content-in-the-c--standard-library-stl\" class=\"anchor\" aria-label=\"Permalink: In the C ++ Standard Library (STL)\" href=\"#in-the-c--standard-library-stl\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eheader file:\u003ccode\u003e#include \u0026lt;memory\u0026gt;\u003c/code\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eC++ 98\u003c/h4\u003e\u003ca id=\"user-content-c-98\" class=\"anchor\" aria-label=\"Permalink: C++ 98\" href=\"#c-98\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"std::auto_ptr\u0026lt;std::string\u0026gt; ps (new std::string(str));\"\u003e\u003cpre\u003estd::auto_ptr\u0026lt;std::string\u0026gt; \u003cspan class=\"pl-en\"\u003eps\u003c/span\u003e (\u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e std::string(str));\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eC++ 11\u003c/h4\u003e\u003ca id=\"user-content-c-11\" class=\"anchor\" aria-label=\"Permalink: C++ 11\" href=\"#c-11\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eshared_ptr\u003c/li\u003e\n\u003cli\u003eunique_ptr\u003c/li\u003e\n\u003cli\u003eweak_ptr\u003c/li\u003e\n\u003cli\u003eauto_ptr (Deprecated by C ++ 11)\u003c/li\u003e\n\u003c/ol\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eClass shared_ptr implements the concept of shared ownership. Multiple smart pointers point to the same object, and that object and its associated resources are released when the \"last reference is destroyed\". In order to perform the above work in more complex scenarios, the standard library provides auxiliary classes such as weak_ptr, bad_weak_ptr, and enable_shared_from_this.\u003c/li\u003e\n\u003cli\u003eClass unique_ptr implements the concept of exclusive ownership or strict ownership, ensuring that only one smart pointer can point to the object at a time. You can transfer ownership. It is especially useful for avoiding resource leaks, such as forgetting to delete after new.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eshared_ptr\u003c/h5\u003e\u003ca id=\"user-content-shared_ptr\" class=\"anchor\" aria-label=\"Permalink: shared_ptr\" href=\"#shared_ptr\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eMultiple smart pointers can share the same object, and the last one of the object has the responsibility to destroy the object and clean up all resources related to the object.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSupport custom deleter, which can prevent Cross-DLL problems (object is created by new in dynamic link library (DLL), but deleted by another DLL), and the mutex is automatically released\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eweak_ptr\u003c/h5\u003e\u003ca id=\"user-content-weak_ptr\" class=\"anchor\" aria-label=\"Permalink: weak_ptr\" href=\"#weak_ptr\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eweak_ptr allows you to share but does not own an object. Once the last smart pointer that owns the object loses ownership, any weak_ptr will automatically become empty. Therefore, in addition to the default and copy constructors, weak_ptr only provides a \"accept a shared_ptr\" constructor.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe problem of cycles of references (two objects that have not been used actually refer to each other, making them appear to be in the \"used\" state)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eunique_ptr\u003c/h5\u003e\u003ca id=\"user-content-unique_ptr\" class=\"anchor\" aria-label=\"Permalink: unique_ptr\" href=\"#unique_ptr\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eunique_ptr is a type that has only been available since C ++ 11, and is a smart pointer that can help avoid resource leaks during exceptions. Using exclusive ownership means that you can ensure that an object and its corresponding resource are owned by only one pointer at a time. Once you own the destroyed or programmed empty, or start owning another object, the previously owned object will be destroyed and any corresponding resources will be released.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eunique_ptr is used instead of auto_ptr\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eauto_ptr\u003c/h5\u003e\u003ca id=\"user-content-auto_ptr\" class=\"anchor\" aria-label=\"Permalink: auto_ptr\" href=\"#auto_ptr\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eDeprecated by c ++ 11 due to lack of language features such as \u003ccode\u003estd::move\u003c/code\u003e semantics \"for construction and assignment\", and other flaws.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eauto_ptr compared to unique_ptr\u003c/h5\u003e\u003ca id=\"user-content-auto_ptr-compared-to-unique_ptr\" class=\"anchor\" aria-label=\"Permalink: auto_ptr compared to unique_ptr\" href=\"#auto_ptr-compared-to-unique_ptr\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eauto_ptr can be assigned a copy, and ownership is transferred after copying; unqiue_ptr has no copy assignment semantics, but implements \u003ccode\u003emove\u003c/code\u003e semantics;\u003c/li\u003e\n\u003cli\u003eauto_ptr objects cannot manage arrays (destructive call \u003ccode\u003edelete\u003c/code\u003e), unique_ptr can manage arrays (destructive call\u003ccode\u003edelete []\u003c/code\u003e);\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCasting Operator\u003c/h3\u003e\u003ca id=\"user-content-casting-operator\" class=\"anchor\" aria-label=\"Permalink: Casting Operator\" href=\"#casting-operator\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://msdn.microsoft.com/zh-CN/library/5f6c9f8h.aspx\" rel=\"nofollow\"\u003eMSDN. Casting Operator\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003estatic_cast\u003c/h4\u003e\u003ca id=\"user-content-static_cast\" class=\"anchor\" aria-label=\"Permalink: static_cast\" href=\"#static_cast\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFor non-polymorphic conversions\u003c/li\u003e\n\u003cli\u003eDo not perform runtime type checking (conversion security is not as good as dynamic_cast)\u003c/li\u003e\n\u003cli\u003eUsually used to convert numeric data types (such as float-\u0026gt; int)\u003c/li\u003e\n\u003cli\u003eYou can move the pointer throughout the class hierarchy. It is safe (upward conversion) for a child class to be converted to a parent class, and it is not safe to convert a parent class to a child class (because a child class may have fields or methods that are not in the parent class)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eUpcast is an implicit conversion.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003edynamic_cast\u003c/h4\u003e\u003ca id=\"user-content-dynamic_cast\" class=\"anchor\" aria-label=\"Permalink: dynamic_cast\" href=\"#dynamic_cast\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFor polymorphic type conversions\u003c/li\u003e\n\u003cli\u003ePerform line runtime type checking\u003c/li\u003e\n\u003cli\u003eOnly applicable to pointers or references\u003c/li\u003e\n\u003cli\u003eConversion of ambiguous pointers will fail (return nullptr), but no exception will be thrown\u003c/li\u003e\n\u003cli\u003eYou can move the pointer throughout the class hierarchy, including up conversion, down conversion\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003econst_cast\u003c/h4\u003e\u003ca id=\"user-content-const_cast\" class=\"anchor\" aria-label=\"Permalink: const_cast\" href=\"#const_cast\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eUsed to remove const, volatile, and __unaligned features (such as converting const int to int)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ereinterpret_cast\u003c/h4\u003e\u003ca id=\"user-content-reinterpret_cast\" class=\"anchor\" aria-label=\"Permalink: reinterpret_cast\" href=\"#reinterpret_cast\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSimple reinterpretation for bits\u003c/li\u003e\n\u003cli\u003eMisuse of the reinterpret_cast operator can be very risky. Unless the required conversion itself is low-level, you should use one of the other cast operators.\u003c/li\u003e\n\u003cli\u003eAllows conversion of any pointer to any other pointer type (such as \u003ccode\u003echar *\u003c/code\u003e to \u003ccode\u003eint *\u003c/code\u003e or \u003ccode\u003eOne_class *\u003c/code\u003e to \u003ccode\u003eUnrelated_class *\u003c/code\u003e, but it is not itself safe)\u003c/li\u003e\n\u003cli\u003eAlso allows conversion of any integer type to any pointer type and reverse conversion.\u003c/li\u003e\n\u003cli\u003eThe reinterpret_cast operator cannot lose const, volatile, or __unaligned attributes.\u003c/li\u003e\n\u003cli\u003eA practical use of reinterpret_cast is in a hash function, which is to map values to indexes by making two different values hardly end with the same index.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ebad_cast\u003c/h4\u003e\u003ca id=\"user-content-bad_cast\" class=\"anchor\" aria-label=\"Permalink: bad_cast\" href=\"#bad_cast\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe dynamic_cast operator throws a bad_cast exception because the cast to a reference type fails.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003ebad_cast demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"try { \n Circle\u0026amp; ref_circle = dynamic_cast\u0026lt;Circle\u0026amp;\u0026gt;(ref_shape); \n} \ncatch (bad_cast b) { \n cout \u0026lt;\u0026lt; \u0026quot;Caught: \u0026quot; \u0026lt;\u0026lt; b.what(); \n} \"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etry\u003c/span\u003e { \n Circle\u0026amp; ref_circle = \u003cspan class=\"pl-k\"\u003edynamic_cast\u003c/span\u003e\u0026lt;Circle\u0026amp;\u0026gt;(ref_shape); \n} \n\u003cspan class=\"pl-k\"\u003ecatch\u003c/span\u003e (bad_cast b) { \n cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eCaught: \u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; b.\u003cspan class=\"pl-c1\"\u003ewhat\u003c/span\u003e(); \n} \u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRuntime Type Information (RTTI)\u003c/h3\u003e\u003ca id=\"user-content-runtime-type-information-rtti\" class=\"anchor\" aria-label=\"Permalink: Runtime Type Information (RTTI)\" href=\"#runtime-type-information-rtti\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003edynamic_cast\u003c/h4\u003e\u003ca id=\"user-content-dynamic_cast-1\" class=\"anchor\" aria-label=\"Permalink: dynamic_cast\" href=\"#dynamic_cast-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFor polymorphic type conversions\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003etypeid\u003c/h4\u003e\u003ca id=\"user-content-typeid\" class=\"anchor\" aria-label=\"Permalink: typeid\" href=\"#typeid\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe typeid operator allows determining the type of an object at runtime\u003c/li\u003e\n\u003cli\u003etype \\ _id returns a reference to a type \\ _info object\u003c/li\u003e\n\u003cli\u003eIf you want to get the data type of the derived class through the pointer of the base class, the base class must have a virtual function\u003c/li\u003e\n\u003cli\u003eCan only get the actual type of the object\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003etype_info\u003c/h4\u003e\u003ca id=\"user-content-type_info\" class=\"anchor\" aria-label=\"Permalink: type_info\" href=\"#type_info\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe type_info class describes the type information generated by the compiler in the program. Objects of this class can effectively store pointers to the names of types. The type_info class can also store encoded values suitable for comparing whether two types are equal or comparing their permutation order. The encoding rules and permutation order for the types are unspecified and may vary from program to program.\u003c/li\u003e\n\u003cli\u003eHeader file: \u003ccode\u003etypeinfo\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003etypeid, type_info demo\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#include \u0026lt;iostream\u0026gt;\nusing namespace std;\n\nclass Flyable // can fly\n{\npublic:\n virtual void takeoff() = 0; // take off\n virtual void land() = 0; // land\n};\nclass Bird : public Flyable // bird\n{\npublic:\n void foraging() {...} // foraging\n virtual void takeoff() {...}\n virtual void land() {...}\n virtual ~Bird(){}\n};\nclass Plane : public Flyable // airplane\n{\npublic:\n void carry() {...} // carry\n virtual void takeoff() {...}\n virtual void land() {...}\n};\n\nclass type_info\n{\npublic:\n const char* name() const;\n bool operator == (const type_info \u0026amp; rhs) const;\n bool operator != (const type_info \u0026amp; rhs) const;\n int before(const type_info \u0026amp; rhs) const;\n virtual ~type_info();\nprivate:\n ...\n};\n\nvoid doSomething(Flyable *obj) // do something\n{\n obj-\u0026gt;takeoff();\n\n cout \u0026lt;\u0026lt; typeid(*obj).name() \u0026lt;\u0026lt; endl; // output the type of the incoming object(\u0026quot;class Bird\u0026quot; or \u0026quot;class Plane\u0026quot;)\n\n if(typeid(*obj) == typeid(Bird)) // determine object type\n {\n Bird *bird = dynamic_cast\u0026lt;Bird *\u0026gt;(obj); // object conversion\n bird-\u0026gt;foraging();\n }\n\n obj-\u0026gt;land();\n}\n\nint main(){\n\tBird *b = new Bird();\n\tdoSomething(b);\n\tdelete b;\n\tb = nullptr;\n\treturn 0;\n}\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eiostream\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e \u003cspan class=\"pl-k\"\u003enamespace\u003c/span\u003e \u003cspan class=\"pl-en\"\u003estd\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e;\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eFlyable\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e can fly\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etakeoff\u003c/span\u003e() = 0; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e take off\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eland\u003c/span\u003e() = 0; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e land\u003c/span\u003e\n};\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eBird\u003c/span\u003e : \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eFlyable\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e bird\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eforaging\u003c/span\u003e() {...} \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e foraging\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etakeoff\u003c/span\u003e() {...}\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eland\u003c/span\u003e() {...}\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-en\"\u003e~Bird\u003c/span\u003e(){}\n};\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ePlane\u003c/span\u003e : \u003cspan class=\"pl-k\"\u003epublic\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eFlyable\u003c/span\u003e \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e airplane\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ecarry\u003c/span\u003e() {...} \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e carry\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etakeoff\u003c/span\u003e() {...}\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eland\u003c/span\u003e() {...}\n};\n\n\u003cspan class=\"pl-k\"\u003eclass\u003c/span\u003e \u003cspan class=\"pl-en\"\u003etype_info\u003c/span\u003e\n{\n\u003cspan class=\"pl-k\"\u003epublic:\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e* \u003cspan class=\"pl-en\"\u003ename\u003c/span\u003e() \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eoperator\u003c/span\u003e == (\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e type_info \u0026amp; rhs) \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eoperator\u003c/span\u003e != (\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e type_info \u0026amp; rhs) \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ebefore\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e type_info \u0026amp; rhs) \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003evirtual\u003c/span\u003e \u003cspan class=\"pl-en\"\u003e~type_info\u003c/span\u003e();\n\u003cspan class=\"pl-k\"\u003eprivate:\u003c/span\u003e\n ...\n};\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003edoSomething\u003c/span\u003e(Flyable *obj) \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e do something\u003c/span\u003e\n{\n obj-\u0026gt;\u003cspan class=\"pl-c1\"\u003etakeoff\u003c/span\u003e();\n\n cout \u0026lt;\u0026lt; \u003cspan class=\"pl-c1\"\u003etypeid\u003c/span\u003e(*obj).\u003cspan class=\"pl-c1\"\u003ename\u003c/span\u003e() \u0026lt;\u0026lt; endl; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e output the type of the incoming object(\"class Bird\" or \"class Plane\")\u003c/span\u003e\n\n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003etypeid\u003c/span\u003e(*obj) == \u003cspan class=\"pl-c1\"\u003etypeid\u003c/span\u003e(Bird)) \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e determine object type\u003c/span\u003e\n {\n Bird *bird = \u003cspan class=\"pl-k\"\u003edynamic_cast\u003c/span\u003e\u0026lt;Bird *\u0026gt;(obj); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e object conversion\u003c/span\u003e\n bird-\u0026gt;\u003cspan class=\"pl-c1\"\u003eforaging\u003c/span\u003e();\n }\n\n obj-\u0026gt;\u003cspan class=\"pl-c1\"\u003eland\u003c/span\u003e();\n}\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e(){\n\tBird *b = \u003cspan class=\"pl-k\"\u003enew\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eBird\u003c/span\u003e();\n\t\u003cspan class=\"pl-c1\"\u003edoSomething\u003c/span\u003e(b);\n\t\u003cspan class=\"pl-k\"\u003edelete\u003c/span\u003e b;\n\tb = \u003cspan class=\"pl-c1\"\u003enullptr\u003c/span\u003e;\n\t\u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-effective\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e⭐️ Effective\u003c/h2\u003e\u003ca id=\"user-content-️-effective\" class=\"anchor\" aria-label=\"Permalink: ⭐️ Effective\" href=\"#️-effective\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eEffective C++\u003c/h3\u003e\u003ca id=\"user-content-effective-c\" class=\"anchor\" aria-label=\"Permalink: Effective C++\" href=\"#effective-c\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eTreat C ++ as a language federation (C, Object-Oriented C ++, Template C ++, STL)\u003c/li\u003e\n\u003cli\u003eIt is better to replace the preprocessor with a compiler (try to replace \u003ccode\u003e# define\u003c/code\u003e with \u003ccode\u003econst\u003c/code\u003e, \u003ccode\u003eenum\u003c/code\u003e, \u003ccode\u003einline\u003c/code\u003e)\u003c/li\u003e\n\u003cli\u003eUse const whenever possible\u003c/li\u003e\n\u003cli\u003eMake sure that the object has been initialized before being used (the copy constructor is more efficient than the default copy assignment after construction)\u003c/li\u003e\n\u003cli\u003eUnderstand what functions C ++ silently writes and calls (the compiler secretly creates a default constructor, copy constructor, copy assignment operator, destructor for class)\u003c/li\u003e\n\u003cli\u003eIf you don't want to use the automatically generated function of the compiler, you should explicitly reject it (declare member functions that you don't want to use as private and do not implement them)\u003c/li\u003e\n\u003cli\u003eDeclare a virtual destructor for the polymorphic base class (if the class has any virtual functions, it should have a virtual destructor)\u003c/li\u003e\n\u003cli\u003eDon't let the exception escape the destructor (the destructor should swallow and not propagate the exception, or end the program, instead of spitting out the exception; if you want to handle the exception, you should handle it in a non-destructed ordinary function)\u003c/li\u003e\n\u003cli\u003eNever call virtual functions during construction and destruction (because such calls never descend to the derived class)\u003c/li\u003e\n\u003cli\u003eLet \u003ccode\u003eoperator =\u003c/code\u003e return a \u003ccode\u003ereference to * this\u003c/code\u003e (for chained assignment)\u003c/li\u003e\n\u003cli\u003eHandle \"self-assignment\" in \u003ccode\u003eoperator =\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eWhen assigning an object, be sure to copy \"all member variables within the object\" and \"all base class components\" (call the base class copy constructor)\u003c/li\u003e\n\u003cli\u003eManage resources by objects (resources are obtained in the constructor and released in the destructor. It is recommended to use smart pointers. The resource acquisition time is the initialization time (Resource Acquisition Is Initialization (RAII)).\u003c/li\u003e\n\u003cli\u003eBe careful with copying behavior in resource management classes (the general RAII class copying behavior is: inhibit copying, reference counting, deep copying, transfer of bottom resource ownership (similar to auto_ptr))\u003c/li\u003e\n\u003cli\u003eProvide access to raw resources in the resource management class (access to raw resources may be explicitly or implicitly converted, in general, display conversion is safer, and implicit conversion is more convenient for customers)\u003c/li\u003e\n\u003cli\u003eUse the same form when using new and delete in pairs (\u003ccode\u003e[]\u003c/code\u003e in \u003ccode\u003enew\u003c/code\u003e then\u003ccode\u003e delete []\u003c/code\u003e, \u003ccode\u003enew\u003c/code\u003e without \u003ccode\u003e[]\u003c/code\u003e and \u003ccode\u003edelete\u003c/code\u003e)\u003c/li\u003e\n\u003cli\u003eStore the newed object in (into) a smart pointer in a separate statement (if you do not do this, it may cause undetectable resource leaks due to compiler optimizations)\u003c/li\u003e\n\u003cli\u003eMake interfaces easy to use correctly and not easy to be misused (Promote normal use: Consistency of interfaces, compatible behavior of built-in types; Prevent misuse: Create new types, Restrict operation on types, Constrain object values Eliminate the client's resource management responsibilities)\u003c/li\u003e\n\u003cli\u003eDesigning a class is like designing a type, and you need to consider object creation, destruction, initialization, assignment, value passing, legal values, inheritance relationships, conversion, generalization, and so on.\u003c/li\u003e\n\u003cli\u003ePrefer pass-by-reference-to-const instead of pass-by-value (the former is usually more efficient and avoids slicing problems, but not applicable to built-in types, STL iterators, function objects)\u003c/li\u003e\n\u003cli\u003eWhen an object must be returned, do not deliberately return its reference (never return pointer or reference to a local stack object, or return reference to a heap-allocated object, or return pointer or reference to a local static object, which may be required at the same time. Multiple such objects.)\u003c/li\u003e\n\u003cli\u003eDeclare member variables as private (for encapsulation, consistency, precise control over reads and writes, etc.)\u003c/li\u003e\n\u003cli\u003eRather replace the member function with non-member and non-friend (which can increase packaging flexibility, packaging flexibility, and functional extensibility)\u003c/li\u003e\n\u003cli\u003eIf all parameters (including the metaphoric parameter pointed to by this pointer) require type conversion, please use a non-member function for this\u003c/li\u003e\n\u003cli\u003eConsider writing a swap function that does not throw exceptions\u003c/li\u003e\n\u003cli\u003eDelay the appearance of variable definitions as much as possible (to increase program clarity and improve program efficiency)\u003c/li\u003e\n\u003cli\u003eDo as few transformations as possible (old: \u003ccode\u003e(T) expression\u003c/code\u003e,\u003ccode\u003eT (expression)\u003c/code\u003e; new:\u003ccode\u003econst_cast \u0026lt;T\u0026gt; (expression)\u003c/code\u003e,\u003ccode\u003edynamic_cast \u0026lt;T\u0026gt; (expression)\u003c/code\u003e,\u003ccode\u003ereinterpret_cast \u0026lt;T \u0026gt; (expression)\u003c/code\u003e,\u003ccode\u003estatic_cast \u0026lt;T\u0026gt; (expression)\u003c/code\u003e;; try to avoid transformation, pay attention to efficiency and avoid dynamic_casts, try to design so that no transformation is needed, the transformation can be encapsulated into a function, rather a new type of transformation is preferred)\u003c/li\u003e\n\u003cli\u003eAvoid using handles (including references, pointers, iterators) to point inside the object (to increase encapsulation, make const member functions behave more like const, and reduce \"dangling handles\" (such as dangling pointers, etc.) possibility)\u003c/li\u003e\n\u003cli\u003eIt is worthwhile to work for \"exception safety\" (Exception-safe functions) will not leak resources or allow any data structure to break even if an exception occurs. There are three possible guarantees: basic, strong Type, do not throw abnormal type)\u003c/li\u003e\n\u003cli\u003eThorough understanding of inlining inside and outside (inlining is a compile-time behavior in most C ++ programs; whether an inline function is really inline depends on the compiler; most compilers refuse to be too complex (such as with loops or recursion) ) Function inlining, and all calls to virtual functions (unless they are the most bland) will also cause inlining to fail; the code expansion caused by inline may cause a loss of efficiency; inline functions cannot be upgraded with the upgrade of the library)\u003c/li\u003e\n\u003cli\u003eMinimize the compilation dependencies between files (if you can use object references or object pointers to complete the task, do not use objects; if possible, try to replace class definitions with class declarations; provide differences between declarative and definitions Header file)\u003c/li\u003e\n\u003cli\u003eMake sure your public inheritance moulds out an is-a (is a) relationship (applicable to everything in base classes must apply to derived classes, because every derived class object is also a base class object )\u003c/li\u003e\n\u003cli\u003eAvoid obscuring inherited names (you can use using declarative or forwarding functions to make the obscure names goodbye)\u003c/li\u003e\n\u003cli\u003eDistinguish between interface inheritance and implementation inheritance (under public inheritance, derived classes always inherit the interface of the base class; pure virtual functions only specify interface inheritance; non-pure virtual virtual functions specify interface inheritance and default implementation inheritance; non -virtual function specifies interface inheritance and mandatory implementation inheritance)\u003c/li\u003e\n\u003cli\u003eConsider alternatives to virtual functions (such as the non-virtual interface (NVI) approach of the Template Method design pattern, replacing virtual functions with \"function pointer member variables\" and replacing virtual functions with \u003ccode\u003etr1 :: function\u003c/code\u003e member variables, Replace the virtual function in the inheritance system with another virtual function in the inheritance system)\u003c/li\u003e\n\u003cli\u003eNever redefine inherited non-virtual functions\u003c/li\u003e\n\u003cli\u003eNever redefine inherited default parameter values, because the default parameter value is statically bound (statically bound), but the virtual function is dynamically bound (dynamically bound)\u003c/li\u003e\n\u003cli\u003eThrough compound molding has-a (one) or \"implemented according to something\" (in the application domain, compound means has-a (there is one); in the implementation domain, compound means (Is-implemented-in-terms-of)\u003c/li\u003e\n\u003cli\u003eUse private inheritance wisely and prudently (private inheritance means is-implemented-in-terms-of (implemented according to something)), use composite whenever possible, when the derived class needs to access the members of the protected base class, or needs to re- Use private inheritance when defining inherited virtual functions, or when empty base optimization is required)\u003c/li\u003e\n\u003cli\u003eUse multiple inheritance wisely and prudently (multiple inheritance is more complex than single inheritance, may lead to new ambiguities, and the need for virtual inheritance, but it does have a legitimate purpose, such as \"public inheritance of an interface class\" and \"private inheritance A class that assists implementation \"; virtual inheritance can solve the ambiguity of diamond inheritance under multiple inheritance, but it will increase the size, speed, complexity of initialization and assignment, etc.)\u003c/li\u003e\n\u003cli\u003eUnderstand implicit interfaces and compile-time polymorphism (both classes and templates support interfaces and polymorphism); class interfaces are explicit with signatures as the center, and polymorphism is through virtual Functions occur at runtime; the interface of a template is implicit based on valid expressions, and polymorphism occurs through comprehension of templates and function overloading resolution at compile time)\u003c/li\u003e\n\u003cli\u003eUnderstand the double meaning of typename (declared that the template type parameter is that the meaning of the prefix keywords class and typename are exactly the same; use the keyword typename to identify the nested dependent type name, but not in the base class lists or members Use it as a base class modifier in the member initialization list)\u003c/li\u003e\n\u003cli\u003eLearn to deal with the names in templated base classes (you can refer to the member names in base class templates via \u003ccode\u003ethis-\u0026gt;\u003c/code\u003e in derived class templates, or by a clearly written \"base class qualification modifier\" )\u003c/li\u003e\n\u003cli\u003eExtract parameter-independent code from templates (code bloat caused by non-type template parameters can often be eliminated by replacing template parameters with function parameters or class member variables; because of type parameters The resulting code bloat can often be achieved by having implementation types with identical binary representations share implementation codes)\u003c/li\u003e\n\u003cli\u003eUse member function templates to accept all compatible types (please use member function templates to generate functions that \"accept all compatible types\"; declare member templates for \"generalized copy construction\" or \"generalized assignment operation\" Also need to declare the normal copy constructor and copy assignment operator)\u003c/li\u003e\n\u003cli\u003eWhen you need type conversion, please define non-member functions for the template (when we write a class template, and the \"relevant to this template\" function provided by it supports \"implicit type conversion of all parameters\", please those functions Defined as \"friend function inside class template\")\u003c/li\u003e\n\u003cli\u003ePlease use traits classes to represent type information (traits classes use templates and \"templates specialization\" to make \"type-related information\" available at compile time, and use overloading (overloading) to implement if ... else on types at compile time test)\u003c/li\u003e\n\u003cli\u003eRecognize template metaprogramming (TMP, template metaprogramming)\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMore Effective c++\u003c/h3\u003e\u003ca id=\"user-content-more-effective-c\" class=\"anchor\" aria-label=\"Permalink: More Effective c++\" href=\"#more-effective-c\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eCarefully distinguish between pointers and references (when you know that you need to point to something and never change to point to other things, or when you implement an operator whose syntax requirements cannot be met by pointers, you should choose references; At any other time, use pointers)\u003c/li\u003e\n\u003cli\u003eIt is best to use C ++ cast operators (\u003ccode\u003estatic_cast\u003c/code\u003e, \u003ccode\u003econst_cast\u003c/code\u003e, \u003ccode\u003edynamic_cast\u003c/code\u003e, \u003ccode\u003ereinterpret_cast\u003c/code\u003e)\u003c/li\u003e\n\u003cli\u003eNever polymorphically treat arrays (polymorphism and pointer arithmetic cannot be mixed; array objects almost always involve pointer arithmetic, so arrays and polymorphism should not be mixed)\u003c/li\u003e\n\u003cli\u003eDon't provide default constructor if necessary (to avoid fields in the object being initialized meaninglessly)\u003c/li\u003e\n\u003cli\u003eBe alert to custom \"type conversion functions\" (single argument constructors can be avoided by simple methods (explicit keywords) or proxy classes); implicit type conversion operators can be changed to explicit Member function to avoid unexpected behavior)\u003c/li\u003e\n\u003cli\u003eDistinguish the prefix and postfix forms of the increment / decrement operator (pre-accumulate and take out and return a reference; post-preparation take and accumulate and return a const object; when processing user-defined types Should use pre-increment as much as possible; post-implementation should be based on its pre-brother)\u003c/li\u003e\n\u003cli\u003eNever overload the \u003ccode\u003e\u0026amp;\u0026amp;\u003c/code\u003e, \u003ccode\u003e||\u003c/code\u003e, and \u003ccode\u003e,\u003c/code\u003e operators (\u003ccode\u003e\u0026amp;\u0026amp;\u003c/code\u003e and \u003ccode\u003e||\u003c/code\u003e overloading will replace “sudden-semantic semantics” with “function call semantics”; \u003ccode\u003eThe overload of\u003c/code\u003e does not guarantee that the left expression must be evaluated earlier than the right expression)\u003c/li\u003e\n\u003cli\u003eUnderstand the different meanings of new and delete ( \u003ccode\u003enew operator\u003c/code\u003e, \u003ccode\u003eoperator new\u003c/code\u003e, \u003ccode\u003eplacement new\u003c/code\u003e, \u003ccode\u003eoperator new[]\u003c/code\u003e ; \u003ccode\u003edelete operator\u003c/code\u003e, \u003ccode\u003eoperator delete\u003c/code\u003e, \u003ccode\u003edestructor\u003c/code\u003e, \u003ccode\u003eoperator delete[]\u003c/code\u003e )\u003c/li\u003e\n\u003cli\u003eUse destructors to avoid leaking resources (freeing resources when destructors can avoid resource leaks during exceptions)\u003c/li\u003e\n\u003cli\u003ePrevent resource leaks in constructors (because C ++ will only destruct objects that have already been constructed, the constructor can use try ... catch or auto_ptr (and similar classes) to handle resource leaks when exceptions occur)\u003c/li\u003e\n\u003cli\u003eProhibit exceptions from flowing out of destructors (reason: first, avoid the terminate function being called in the stack-unwinding mechanism of exception propagation; second, help ensure that destructors complete everything they should do)\u003c/li\u003e\n\u003cli\u003eUnderstand the difference between \"throwing an exception\" and \"passing a parameter\" or \"calling a virtual function\" (first, exception objects are always copied (except by pointer), if you catch even by value It is copied twice, but the object passed to the function parameter does not necessarily have to be copied. Second, the object that is \"thrown as exceptions\" has fewer allowed type conversion actions than the object \"passed to the function\"; Third, the catch clause is checked by the compiler for its \"order in which it appears in the source code\". The first match succeeds and is executed, and a virtual function is called. Function \"\u003c/li\u003e\n\u003cli\u003eCapture exceptions by by reference (to avoid the problem of object deletion and cutting of exception objects, retain the ability to catch standard exceptions, and restrict the number of times an exception object needs to be copied)\u003c/li\u003e\n\u003cli\u003eUse exception specifications wisely (exception specifications provide an excellent description of what kind of exceptions a function expects to throw; there are also some disadvantages, including that the compiler only checks them locally and is easy to inadvertently violate them. Prevent higher-level exception handlers from handling unexpected exceptions)\u003c/li\u003e\n\u003cli\u003eUnderstand the cost of exception handling (roughly estimated, if try block is used, the overall code will expand by about 5% -10%, and the execution speed will also decrease by this number; therefore, please limit your use of try block and exception specifications Must-use locations, and throw exceptions only in case of real exceptions)\u003c/li\u003e\n\u003cli\u003eKeep in mind the 80-20 rule (the overall performance of software is almost always determined by a small part of its constituent elements (codes), and the code that consumes resources can be identified using a program profiler)\u003c/li\u003e\n\u003cli\u003eConsider using lazy evaluation (can be applied to: Reference Counting to avoid unnecessary object copying, distinguish read and write actions of operator [] to do different things, Lazy Fetching (easy (Remove) to avoid unnecessary database reads, and Lazy Expression Evaluation (to avoid unnecessary numerical calculations)\u003c/li\u003e\n\u003cli\u003eAmortize the expected computational cost (when you must support certain operations whose structure is almost always required, or when the results are often required multiple times, over-eager evaluation can improve program efficiency )\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGoogle C ++ Style Guide\u003c/h3\u003e\u003ca id=\"user-content-google-c--style-guide\" class=\"anchor\" aria-label=\"Permalink: Google C ++ Style Guide\" href=\"#google-c--style-guide\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eEnglish: \u003ca href=\"https://google.github.io/styleguide/cppguide.html\" rel=\"nofollow\"\u003eGoogle C ++ Style Guide\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eChinese: \u003ca href=\"https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/contents/\" rel=\"nofollow\"\u003eC ++ Style Guide\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOther\u003c/h3\u003e\u003ca id=\"user-content-other\" class=\"anchor\" aria-label=\"Permalink: Other\" href=\"#other\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"http://www.stroustrup.com/bs_faq.html\" rel=\"nofollow\"\u003eBjarne Stroustrup FAQ\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://www.stroustrup.com/bs_faq2.html\" rel=\"nofollow\"\u003eC ++ style and trick FAQ for Bjarne Stroustrup\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-stl\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e📦 STL\u003c/h2\u003e\u003ca id=\"user-content--stl\" class=\"anchor\" aria-label=\"Permalink: 📦 STL\" href=\"#-stl\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSTL index\u003c/h3\u003e\u003ca id=\"user-content-stl-index\" class=\"anchor\" aria-label=\"Permalink: STL index\" href=\"#stl-index\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL\"\u003eSTL Method Meaning Index\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSTL container\u003c/h3\u003e\u003ca id=\"user-content-stl-container\" class=\"anchor\" aria-label=\"Permalink: STL container\" href=\"#stl-container\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eContainer\u003c/th\u003e\n\u003cth\u003eUnderlying data structure\u003c/th\u003e\n\u003cth\u003eTime complexity\u003c/th\u003e\n\u003cth\u003eUnordered\u003c/th\u003e\n\u003cth\u003eCan not be repeated\u003c/th\u003e\n\u003cth\u003eOther\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#array\"\u003earray\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003earray\u003c/td\u003e\n\u003ctd\u003erandom read and change O(1)\u003c/td\u003e\n\u003ctd\u003eunordered\u003c/td\u003e\n\u003ctd\u003erepeatable\u003c/td\u003e\n\u003ctd\u003esupport random access\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#vector\"\u003evector\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eArray\u003c/td\u003e\n\u003ctd\u003eRandom read, tail insertion, tail deletion O(1) \u003cbr\u003e head insertion, head Delete O(n)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003eSupport random access\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#deque\"\u003edeque\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eDual-end queue\u003c/td\u003e\n\u003ctd\u003eEnd-to-end insertion, end-to-end deletion O(1)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003eOne central control + Multiple buffers, support rapid addition and deletion at the beginning and end, support random access\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#forward_list\"\u003eforward_list\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eOne-way linked list\u003c/td\u003e\n\u003ctd\u003eInsert and delete O(1)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003eRandom access is not supported\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#list\"\u003elist\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eDoubly linked list\u003c/td\u003e\n\u003ctd\u003eInsert / delete O(1)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003eDoes not support random access\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#stack\"\u003estack\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003edeque / list\u003c/td\u003e\n\u003ctd\u003etop insert, top delete O(1)\u003c/td\u003e\n\u003ctd\u003eunordered\u003c/td\u003e\n\u003ctd\u003erepeatable\u003c/td\u003e\n\u003ctd\u003edeque or list closed head The end is open. The reason why the vector is not used should be that the capacity is limited, and the expansion takes time.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#queue\"\u003equeue\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003edeque / list\u003c/td\u003e\n\u003ctd\u003etail insertion, head deletion O(1)\u003c/td\u003e\n\u003ctd\u003eunordered\u003c/td\u003e\n\u003ctd\u003erepeatable\u003c/td\u003e\n\u003ctd\u003edeque or list closure The head end is open. The reason why the vector is not used should be that the capacity is limited, and the expansion takes time.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#priority_queue\"\u003epriority_queue\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003evector + max-heap\u003c/td\u003e\n\u003ctd\u003eInsert, delete O(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eOrdered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003evector container + heap processing rules\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#set\"\u003eset\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eRed and Black Tree\u003c/td\u003e\n\u003ctd\u003eInsert, delete, find O(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eOrdered\u003c/td\u003e\n\u003ctd\u003eNot repeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#multiset\"\u003emultiset\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eRed and Black Tree\u003c/td\u003e\n\u003ctd\u003eInsert, delete, find O(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eOrdered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#map\"\u003emap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eRed and Black Tree\u003c/td\u003e\n\u003ctd\u003eInsert, delete, find O(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eOrdered\u003c/td\u003e\n\u003ctd\u003eNot repeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#multimap\"\u003emultimap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eRed and Black Tree\u003c/td\u003e\n\u003ctd\u003eInsert, delete, find O(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eOrdered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#unordered_set\"\u003eunordered_set\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHash Table\u003c/td\u003e\n\u003ctd\u003eInsert, Delete, Find O(1) Worst O(n)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eNot Repeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#unordered_multiset\"\u003eunordered_multiset\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHash Table\u003c/td\u003e\n\u003ctd\u003eInsert, Delete, Find O(1) Worst O(n)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#unordered_map\"\u003eunordered_map\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHash Table\u003c/td\u003e\n\u003ctd\u003eInsert, Delete, Find O(1) Worst O(n)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eNot Repeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/STL#unordered_multimap\"\u003eunordered_multimap\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eHash Table\u003c/td\u003e\n\u003ctd\u003eInsert, Delete, Find O(1) Worst O(n)\u003c/td\u003e\n\u003ctd\u003eUnordered\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSTL Algorithm\u003c/h3\u003e\u003ca id=\"user-content-stl-algorithm\" class=\"anchor\" aria-label=\"Permalink: STL Algorithm\" href=\"#stl-algorithm\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eAlgorithm\u003c/th\u003e\n\u003cth\u003eLow-level algorithm\u003c/th\u003e\n\u003cth\u003eTime complexity\u003c/th\u003e\n\u003cth\u003eCan not be repeated\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"http://www.cplusplus.com/reference/algorithm/find/\" rel=\"nofollow\"\u003efind\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eSequence search\u003c/td\u003e\n\u003ctd\u003eO(n)\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/include/bits/stl_algo.h#L4808\"\u003esort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://en.wikipedia.org/wiki/Introsort\" rel=\"nofollow\"\u003eIntrospection sorting\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n*log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eRepeatable\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-data-structure\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e〽️ Data Structure\u003c/h2\u003e\u003ca id=\"user-content-️-data-structure\" class=\"anchor\" aria-label=\"Permalink: 〽️ Data Structure\" href=\"#️-data-structure\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSequence structure\u003c/h3\u003e\u003ca id=\"user-content-sequence-structure\" class=\"anchor\" aria-label=\"Permalink: Sequence structure\" href=\"#sequence-structure\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSequential stack(Sequence Stack)\u003c/h4\u003e\u003ca id=\"user-content-sequential-stacksequence-stack\" class=\"anchor\" aria-label=\"Permalink: Sequential stack(Sequence Stack)\" href=\"#sequential-stacksequence-stack\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/SqStack.cpp\"\u003eSqStack.cpp\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSequential stack data structures and pictures\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"typedef struct {\n\tElemType *elem;\n\tint top;\n\tint size;\n\tint increment;\n} SqStack;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e {\n\tElemType *elem;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e top;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e size;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e increment;\n} SqStack;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqStack.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqStack.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003equeue(Sequence Queue)\u003c/h4\u003e\u003ca id=\"user-content-queuesequence-queue\" class=\"anchor\" aria-label=\"Permalink: queue(Sequence Queue)\" href=\"#queuesequence-queue\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eQueue data structure\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"typedef struct {\n\tElemType * elem;\n\tint front;\n\tint rear;\n\tint maxSize;\n}SqQueue;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e {\n\tElemType * elem;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e front;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e rear;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e maxSize;\n}SqQueue;\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAcyclic queue\u003c/h5\u003e\u003ca id=\"user-content-acyclic-queue\" class=\"anchor\" aria-label=\"Permalink: Acyclic queue\" href=\"#acyclic-queue\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAcyclic queue picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqQueue.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqQueue.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003eSqQueue.rear++\u003c/code\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCircular queue\u003c/h5\u003e\u003ca id=\"user-content-circular-queue\" class=\"anchor\" aria-label=\"Permalink: Circular queue\" href=\"#circular-queue\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCircular queue picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqLoopStack.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqLoopStack.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003eSqQueue.rear = (SqQueue.rear + 1) % SqQueue.maxSize\u003c/code\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSequence table(Sequence List)\u003c/h4\u003e\u003ca id=\"user-content-sequence-tablesequence-list\" class=\"anchor\" aria-label=\"Permalink: Sequence table(Sequence List)\" href=\"#sequence-tablesequence-list\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/SqList.cpp\"\u003eSqList.cpp\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSequence table data structure and pictures\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"typedef struct {\n\tElemType *elem;\n\tint length;\n\tint size;\n\tint increment;\n} SqList;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e {\n\tElemType *elem;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e length;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e size;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e increment;\n} SqList;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqList.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqList.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eChain structure\u003c/h3\u003e\u003ca id=\"user-content-chain-structure\" class=\"anchor\" aria-label=\"Permalink: Chain structure\" href=\"#chain-structure\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/LinkList.cpp\"\u003eLinkList.cpp\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/LinkList_with_head.cpp\"\u003eLinkList_with_head.cpp\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eChained data structure\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"typedef struct LNode {\n ElemType data;\n struct LNode *next;\n} LNode, *LinkList; \"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eLNode\u003c/span\u003e {\n ElemType data;\n \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eLNode\u003c/span\u003e *next;\n} LNode, *LinkList; \u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eChain queue(Link Queue)\u003c/h4\u003e\u003ca id=\"user-content-chain-queuelink-queue\" class=\"anchor\" aria-label=\"Permalink: Chain queue(Link Queue)\" href=\"#chain-queuelink-queue\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eChain queue picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/LinkQueue.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/LinkQueue.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eChained representation of a linear list\u003c/h4\u003e\u003ca id=\"user-content-chained-representation-of-a-linear-list\" class=\"anchor\" aria-label=\"Permalink: Chained representation of a linear list\" href=\"#chained-representation-of-a-linear-list\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSingly-Linked list(Link List)\u003c/h5\u003e\u003ca id=\"user-content-singly-linked-listlink-list\" class=\"anchor\" aria-label=\"Permalink: Singly-Linked list(Link List)\" href=\"#singly-linked-listlink-list\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eSingly-linked list picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/LinkList.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/LinkList.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDoubly linked list(Du-Link-List)\u003c/h5\u003e\u003ca id=\"user-content-doubly-linked-listdu-link-list\" class=\"anchor\" aria-label=\"Permalink: Doubly linked list(Du-Link-List)\" href=\"#doubly-linked-listdu-link-list\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eDoubly-linked list picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/DuLinkList.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/DuLinkList.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCircular linked list(Cir-Link-List)\u003c/h5\u003e\u003ca id=\"user-content-circular-linked-listcir-link-list\" class=\"anchor\" aria-label=\"Permalink: Circular linked list(Cir-Link-List)\" href=\"#circular-linked-listcir-link-list\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCircular-linked list picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/CirLinkList.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/CirLinkList.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHash table\u003c/h3\u003e\u003ca id=\"user-content-hash-table\" class=\"anchor\" aria-label=\"Permalink: Hash table\" href=\"#hash-table\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/HashTable.cpp\"\u003eHashTable.cpp\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConcept\u003c/h4\u003e\u003ca id=\"user-content-concept\" class=\"anchor\" aria-label=\"Permalink: Concept\" href=\"#concept\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHash function:\u003ccode\u003eH(key): K -\u0026gt; D , key ∈ K\u003c/code\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConstruction method\u003c/h4\u003e\u003ca id=\"user-content-construction-method\" class=\"anchor\" aria-label=\"Permalink: Construction method\" href=\"#construction-method\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eDirect Addressing\u003c/li\u003e\n\u003cli\u003eDivided remainder method\u003c/li\u003e\n\u003cli\u003eDigital analysis method\u003c/li\u003e\n\u003cli\u003eFolding method\u003c/li\u003e\n\u003cli\u003eThe square method\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCollision resolution method\u003c/h4\u003e\u003ca id=\"user-content-collision-resolution-method\" class=\"anchor\" aria-label=\"Permalink: Collision resolution method\" href=\"#collision-resolution-method\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eChain address method: single linked list linked with the same key\u003c/li\u003e\n\u003cli\u003eOpen Addressing\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eLinear detection method: same key-\u0026gt; put to the next position of key,\u003ccode\u003eHi = (H(key) + i) % m\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eSecondary detection method: same key-\u0026gt; put to \u003ccode\u003eDi = 1^2, -1^2, ..., ±(k)^2,(k\u0026lt;=m/2)\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eRandom detection:\u003ccode\u003eH = (H(key) + Pseudo-random number) % m\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHash table data structure for linear probing\u003c/h4\u003e\u003ca id=\"user-content-hash-table-data-structure-for-linear-probing\" class=\"anchor\" aria-label=\"Permalink: Hash table data structure for linear probing\" href=\"#hash-table-data-structure-for-linear-probing\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHash table data structure and pictures for linear detection\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"typedef char KeyType;\n\ntypedef struct {\n\tKeyType key;\n}RcdType;\n\ntypedef struct {\n\tRcdType *rcd;\n\tint size;\n\tint count;\n\tbool *tag;\n}HashTable;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e KeyType;\n\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e {\n\tKeyType key;\n}RcdType;\n\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e {\n\tRcdType *rcd;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e size;\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e count;\n\t\u003cspan class=\"pl-k\"\u003ebool\u003c/span\u003e *tag;\n}HashTable;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/HashTable.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/HashTable.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRecursion\u003c/h3\u003e\u003ca id=\"user-content-recursion\" class=\"anchor\" aria-label=\"Permalink: Recursion\" href=\"#recursion\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConcept\u003c/h4\u003e\u003ca id=\"user-content-concept-1\" class=\"anchor\" aria-label=\"Permalink: Concept\" href=\"#concept-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFunction calls itself directly or indirectly\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRecursion and Divide\u003c/h4\u003e\u003ca id=\"user-content-recursion-and-divide\" class=\"anchor\" aria-label=\"Permalink: Recursion and Divide\" href=\"#recursion-and-divide\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eDivide and Conquer\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBreakdown of the problem\u003c/li\u003e\n\u003cli\u003eProblem size decomposition\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eHalf search (recursive)\u003c/li\u003e\n\u003cli\u003eMerge sort (recursive)\u003c/li\u003e\n\u003cli\u003eQuick sort (recursive)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRecursion and Iteration\u003c/h4\u003e\u003ca id=\"user-content-recursion-and-iteration\" class=\"anchor\" aria-label=\"Permalink: Recursion and Iteration\" href=\"#recursion-and-iteration\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eIteration: use the old value of the variable repeatedly to push out the new value\u003c/li\u003e\n\u003cli\u003eSearch in half (iterative)\u003c/li\u003e\n\u003cli\u003eMerge sort (iterative)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGeneralized table\u003c/h4\u003e\u003ca id=\"user-content-generalized-table\" class=\"anchor\" aria-label=\"Permalink: Generalized table\" href=\"#generalized-table\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHead and tail linked list storage representation\u003c/h5\u003e\u003ca id=\"user-content-head-and-tail-linked-list-storage-representation\" class=\"anchor\" aria-label=\"Permalink: Head and tail linked list storage representation\" href=\"#head-and-tail-linked-list-storage-representation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHead and tail linked list storage representations and pictures for generalized tables\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// Head-to-tail linked list storage representation of generalized list\ntypedef enum {ATOM, LIST} ElemTag;\n// ATOM == 0: atom, LIST == 1: child table\ntypedef struct GLNode {\n ElemTag tag;\n // public part, used to distinguish atomic nodes from table nodes\n union {\n // joint part of atomic node and table node\n AtomType atom;\n // atom is the range of atom nodes, AtomType is defined by the user\n struct {\n struct GLNode *hp, *tp;\n } ptr;\n /// ptr is the pointer field of the table node, prt.hp and ptr.tp point to the table header and table tail respectively\n } a;\n} *GList, GLNode;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Head-to-tail linked list storage representation of generalized list\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eenum\u003c/span\u003e {ATOM, LIST} ElemTag;\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e ATOM == 0: atom, LIST == 1: child table\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eGLNode\u003c/span\u003e {\n ElemTag tag;\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e public part, used to distinguish atomic nodes from table nodes\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003eunion\u003c/span\u003e {\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e joint part of atomic node and table node\u003c/span\u003e\n AtomType atom;\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e atom is the range of atom nodes, AtomType is defined by the user\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e {\n \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eGLNode\u003c/span\u003e *hp, *tp;\n } ptr;\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e/ ptr is the pointer field of the table node, prt.hp and ptr.tp point to the table header and table tail respectively\u003c/span\u003e\n } a;\n} *GList, GLNode;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList1.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList1.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eExtended linear linked list storage representation\u003c/h5\u003e\u003ca id=\"user-content-extended-linear-linked-list-storage-representation\" class=\"anchor\" aria-label=\"Permalink: Extended linear linked list storage representation\" href=\"#extended-linear-linked-list-storage-representation\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eExtended linear linked list storage representations and pictures\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// Extended linear linked list storage representation of generalized tables\ntypedef enum {ATOM, LIST} ElemTag;\n// ATOM == 0: atom, LIST == 1: child table\ntypedef struct GLNode1 {\n ElemTag tag;\n // public part, used to distinguish atomic nodes from table nodes\n union {\n // joint part of atomic node and table node\n AtomType atom; // range of atom nodes\n struct GLNode1 *hp; // table pointer pointer\n } a;\n struct GLNode1 *tp;\n // Equivalent to next of a linear linked list, pointing to the next \n} *GList1, GLNode1;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Extended linear linked list storage representation of generalized tables\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eenum\u003c/span\u003e {ATOM, LIST} ElemTag;\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e ATOM == 0: atom, LIST == 1: child table\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eGLNode1\u003c/span\u003e {\n ElemTag tag;\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e public part, used to distinguish atomic nodes from table nodes\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003eunion\u003c/span\u003e {\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e joint part of atomic node and table node\u003c/span\u003e\n AtomType atom; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e range of atom nodes\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eGLNode1\u003c/span\u003e *hp; \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e table pointer pointer\u003c/span\u003e\n } a;\n \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eGLNode1\u003c/span\u003e *tp;\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Equivalent to next of a linear linked list, pointing to the next \u003c/span\u003e\n} *GList1, GLNode1;\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList2.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList2.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBinary tree\u003c/h3\u003e\u003ca id=\"user-content-binary-tree\" class=\"anchor\" aria-label=\"Permalink: Binary tree\" href=\"#binary-tree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/BinaryTree.cpp\"\u003eBinaryTree.cpp\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eproperties\u003c/h4\u003e\u003ca id=\"user-content-properties\" class=\"anchor\" aria-label=\"Permalink: properties\" href=\"#properties\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eUp to 2\u003csup\u003e(i-1)\u003c/sup\u003e nodes at the i-th level of a non-empty binary tree (i\u0026gt; = 1)\u003c/li\u003e\n\u003cli\u003eBinary tree with depth k up to 2\u003csup\u003ek\u003c/sup\u003e-1 node (k \u0026gt;= 1)\u003c/li\u003e\n\u003cli\u003eThe number of nodes with degree 0 is n\u003csub\u003e0\u003c/sub\u003e, and the number of nodes with degree 2 is n\u003csub\u003e2\u003c/sub\u003e, then n\u003csub\u003e0\u003c/sub\u003e = n\u003csub\u003e2\u003c/sub\u003e + 1\u003c/li\u003e\n\u003cli\u003eFull binary tree depth with n nodes k = ⌊ log \u003csub\u003e 2 \u0026lt;/ sub\u0026gt; (n) ⌋ + 1\u003c/sub\u003e\u003c/li\u003e\n\u003cli\u003eFor the node numbered i (1 \u0026lt;= i \u0026lt;= n) in a complete binary tree with n nodes\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eIf i = 1, it is the root, otherwise the parents are ⌊ i / 2 ⌋\u003c/li\u003e\n\u003cli\u003eIf 2i \u0026gt; n, node i has no left child, otherwise the child number is 2i\u003c/li\u003e\n\u003cli\u003eIf 2i + 1\u0026gt; n, the i node has no right child, otherwise the child number is 2i + 1\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eStorage structure\u003c/h4\u003e\u003ca id=\"user-content-storage-structure\" class=\"anchor\" aria-label=\"Permalink: Storage structure\" href=\"#storage-structure\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBinary tree data structure\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"typedef struct BiTNode\n{\n TElemType data;\n struct BiTNode *lchild, *rchild;\n}BiTNode, *BiTree;\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eBiTNode\u003c/span\u003e\n{\n TElemType data;\n \u003cspan class=\"pl-k\"\u003estruct\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eBiTNode\u003c/span\u003e *lchild, *rchild;\n}BiTNode, *BiTree;\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSequential storage\u003c/h5\u003e\u003ca id=\"user-content-sequential-storage\" class=\"anchor\" aria-label=\"Permalink: Sequential storage\" href=\"#sequential-storage\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBinary tree sequential storage pictures\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqBinaryTree.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/SqBinaryTree.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eChained storage\u003c/h5\u003e\u003ca id=\"user-content-chained-storage\" class=\"anchor\" aria-label=\"Permalink: Chained storage\" href=\"#chained-storage\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBinary tree chain store pictures\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/LinkBinaryTree.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/LinkBinaryTree.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTraversal\u003c/h4\u003e\u003ca id=\"user-content-traversal\" class=\"anchor\" aria-label=\"Permalink: Traversal\" href=\"#traversal\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSequence traversal\u003c/li\u003e\n\u003cli\u003eIn-order traversal\u003c/li\u003e\n\u003cli\u003eSubsequent traversals\u003c/li\u003e\n\u003cli\u003eHierarchical traversal\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCategories\u003c/h4\u003e\u003ca id=\"user-content-categories\" class=\"anchor\" aria-label=\"Permalink: Categories\" href=\"#categories\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFull Binary Tree\u003c/li\u003e\n\u003cli\u003eComplete binary tree (heap)\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBig top heap: root\u0026gt; = left \u0026amp;\u0026amp; root\u0026gt; = right\u003c/li\u003e\n\u003cli\u003eSmall top heap: root \u0026lt;= left \u0026amp;\u0026amp; root \u0026lt;= right\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eBinary search tree (binary sort tree): left \u0026lt;root \u0026lt;right\u003c/li\u003e\n\u003cli\u003eBalanced binary tree (AVL tree): | Left subtree tree height-Right subtree tree height | \u0026lt;= 1\u003c/li\u003e\n\u003cli\u003eLeast Imbalanced Tree: Balanced Binary Tree Inserting New Nodes Causes Imbalanced Subtree: Adjustment:\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eLL type: left-handed child of the root\u003c/li\u003e\n\u003cli\u003eRR type: right child of the root\u003c/li\u003e\n\u003cli\u003eLR type: Left-handed child of the root, left-handed\u003c/li\u003e\n\u003cli\u003eRL type: Left child of right child, turn right first, then left\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOther trees and forests\u003c/h3\u003e\u003ca id=\"user-content-other-trees-and-forests\" class=\"anchor\" aria-label=\"Permalink: Other trees and forests\" href=\"#other-trees-and-forests\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eThe storage structure of the tree\u003c/h4\u003e\u003ca id=\"user-content-the-storage-structure-of-the-tree\" class=\"anchor\" aria-label=\"Permalink: The storage structure of the tree\" href=\"#the-storage-structure-of-the-tree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eParental notation\u003c/li\u003e\n\u003cli\u003eParental notation\u003c/li\u003e\n\u003cli\u003eChild brother notation\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAnd check\u003c/h4\u003e\u003ca id=\"user-content-and-check\" class=\"anchor\" aria-label=\"Permalink: And check\" href=\"#and-check\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eA set of disjoint subsets S = {S1, S2, ..., Sn}\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBalanced Binary Tree (AVL Tree)\u003c/h4\u003e\u003ca id=\"user-content-balanced-binary-tree-avl-tree\" class=\"anchor\" aria-label=\"Permalink: Balanced Binary Tree (AVL Tree)\" href=\"#balanced-binary-tree-avl-tree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003enature\u003c/h5\u003e\u003ca id=\"user-content-nature\" class=\"anchor\" aria-label=\"Permalink: nature\" href=\"#nature\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e| Left Subtree Tree Height-Right Subtree Tree Height | \u0026lt;= 1\u003c/li\u003e\n\u003cli\u003eA balanced binary tree must be a binary search tree, otherwise it is not necessarily\u003c/li\u003e\n\u003cli\u003eThe formula of the nodes of the minimum binary balanced tree: \u003ccode\u003eF(n) = F(n-1) + F(n-2) + 1\u003c/code\u003e (1 is the root node, F (n-1) is the left subtree Number of nodes, F (n-2) is the number of nodes in the right subtree)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eBalanced binary tree pictures\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/Self-balancingBinarySearchTree.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/Self-balancingBinarySearchTree.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMinimal Imbalance Tree\u003c/h5\u003e\u003ca id=\"user-content-minimal-imbalance-tree\" class=\"anchor\" aria-label=\"Permalink: Minimal Imbalance Tree\" href=\"#minimal-imbalance-tree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBalanced binary tree inserting new nodes causes unbalanced subtrees\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eAdjustment:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eLL type: left child of the root\u003c/li\u003e\n\u003cli\u003eRR type: right child of the root\u003c/li\u003e\n\u003cli\u003eLR type: Left-handed child of the root, left-handed, then right-handed\u003c/li\u003e\n\u003cli\u003eRL type: Left child of right child, right-handed first, then left-handed\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRed black tree\u003c/h4\u003e\u003ca id=\"user-content-red-black-tree\" class=\"anchor\" aria-label=\"Permalink: Red black tree\" href=\"#red-black-tree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/RedBlackTree.cpp\"\u003eRedBlackTree.cpp\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhat are the characteristics of red-black trees?\u003c/h5\u003e\u003ca id=\"user-content-what-are-the-characteristics-of-red-black-trees\" class=\"anchor\" aria-label=\"Permalink: What are the characteristics of red-black trees?\" href=\"#what-are-the-characteristics-of-red-black-trees\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eThe nodes are red or black.\u003c/li\u003e\n\u003cli\u003eThe root is black.\u003c/li\u003e\n\u003cli\u003eAll leaves are black (the leaves are NIL nodes).\u003c/li\u003e\n\u003cli\u003eEach red node must have two black child nodes. (There cannot be two consecutive red nodes on all paths from each leaf to the root.) (The parent node of the new node must be the same)\u003c/li\u003e\n\u003cli\u003eAll simple paths from any node to each of its leaves contain the same number of black nodes. (New nodes must be red)\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAdjustment\u003c/h5\u003e\u003ca id=\"user-content-adjustment\" class=\"anchor\" aria-label=\"Permalink: Adjustment\" href=\"#adjustment\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eDiscoloration\nLeft\nRight turn\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eApplication\u003c/h5\u003e\u003ca id=\"user-content-application\" class=\"anchor\" aria-label=\"Permalink: Application\" href=\"#application\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAssociative arrays: such as map, set in STL\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhat is the difference between red and black trees, B trees, and B + trees?\u003c/h5\u003e\u003ca id=\"user-content-what-is-the-difference-between-red-and-black-trees-b-trees-and-b--trees\" class=\"anchor\" aria-label=\"Permalink: What is the difference between red and black trees, B trees, and B + trees?\" href=\"#what-is-the-difference-between-red-and-black-trees-b-trees-and-b--trees\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe depth of the red-black tree is larger, while the depth of the B-tree and B + -tree is relatively smaller\u003c/li\u003e\n\u003cli\u003eB + trees store data in leaf nodes, and connect them together in the form of linked lists.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eB-tree, B + -tree\u003c/h4\u003e\u003ca id=\"user-content-b-tree-b---tree\" class=\"anchor\" aria-label=\"Permalink: B-tree, B + -tree\" href=\"#b-tree-b---tree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eB-tree, B+-tree pictures\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/37684966582d6ca9ab5f976e3a2a1e4b4f7e4a03ae761eaae6771f65be5f0f72/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f6c365579462e706e67\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/37684966582d6ca9ab5f976e3a2a1e4b4f7e4a03ae761eaae6771f65be5f0f72/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f6c365579462e706e67\" alt=\"B tree (B-tree), B+ tree (B+-tree)\" data-canonical-src=\"https://i.stack.imgur.com/l6UyF.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFeatures\u003c/h5\u003e\u003ca id=\"user-content-features-1\" class=\"anchor\" aria-label=\"Permalink: Features\" href=\"#features-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eGeneralized binary search tree\u003c/li\u003e\n\u003cli\u003e\"Puffy\", internal (non-leaf) nodes can have a variable number of child nodes (the number range is predefined)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eApplication\u003c/h5\u003e\u003ca id=\"user-content-application-1\" class=\"anchor\" aria-label=\"Permalink: Application\" href=\"#application-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eMost file systems and database systems use B-trees and B + trees as index structures\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ethe difference\u003c/h5\u003e\u003ca id=\"user-content-the-difference-1\" class=\"anchor\" aria-label=\"Permalink: the difference\" href=\"#the-difference-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eOnly leaf nodes in the B + tree will have pointers to records (ROWID), while all nodes in the B-tree will have, and the index items appearing in the internal nodes will no longer appear in the leaf nodes.\u003c/li\u003e\n\u003cli\u003eAll leaf nodes in the B + tree are connected by pointers, while the B tree does not.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAdvantages of B-tree\u003c/h5\u003e\u003ca id=\"user-content-advantages-of-b-tree\" class=\"anchor\" aria-label=\"Permalink: Advantages of B-tree\" href=\"#advantages-of-b-tree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe data at the internal nodes can be obtained directly without having to locate according to the leaf nodes.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAdvantages of B + trees\u003c/h5\u003e\u003ca id=\"user-content-advantages-of-b--trees\" class=\"anchor\" aria-label=\"Permalink: Advantages of B + trees\" href=\"#advantages-of-b--trees\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eNon-leaf nodes do not carry ROWID. In this way, more index entries can be accommodated in a block. One is to reduce the height of the tree. The second is that an internal node can locate more leaf nodes.\u003c/li\u003e\n\u003cli\u003eThe leaf nodes are connected by pointers. The range scan will be very simple. For the B-tree, the leaf nodes and internal nodes need to be moved back and forth continuously.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eThe difference between B-tree and B + -tree comes from:\u003ca href=\"https://stackoverflow.com/questions/870218/differences-between-b-trees-and-b-trees\" rel=\"nofollow\"\u003edifferences-between-b-trees-and-b-trees\u003c/a\u003e、\u003ca href=\"https://www.cnblogs.com/ivictor/p/5849061.html\" rel=\"nofollow\"\u003eDifference between B-tree and B + tree\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOctree\u003c/h4\u003e\u003ca id=\"user-content-octree\" class=\"anchor\" aria-label=\"Permalink: Octree\" href=\"#octree\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eOctree picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/24e4f4240b5cd3109c3dc74cb8327e7024cf4c55eda94417c0c9a8dafe1d2132/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f332f33352f4f6374726565322e706e672f34303070782d4f6374726565322e706e67\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/24e4f4240b5cd3109c3dc74cb8327e7024cf4c55eda94417c0c9a8dafe1d2132/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f332f33352f4f6374726565322e706e672f34303070782d4f6374726565322e706e67\" alt=\"\" data-canonical-src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Octree2.png/400px-Octree2.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eAn octree is a tree-like data structure used to describe three-dimensional space (dividing space). Each node of the octree represents a volume element of a cube, and each node has eight child nodes. The volume elements represented by the eight child nodes are added together to equal the volume of the parent node. The general center point is used as the bifurcation center of the node.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePurpose\u003c/h5\u003e\u003ca id=\"user-content-purpose\" class=\"anchor\" aria-label=\"Permalink: Purpose\" href=\"#purpose\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e3D computer graphics\u003c/li\u003e\n\u003cli\u003eNearest Search\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-algorithm\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e⚡️ Algorithm\u003c/h2\u003e\u003ca id=\"user-content-️-algorithm\" class=\"anchor\" aria-label=\"Permalink: ⚡️ Algorithm\" href=\"#️-algorithm\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSort\u003c/h3\u003e\u003ca id=\"user-content-sort\" class=\"anchor\" aria-label=\"Permalink: Sort\" href=\"#sort\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSorting Algorithm\u003c/th\u003e\n\u003cth\u003eAverage Time Complexity\u003c/th\u003e\n\u003cth\u003eWorst Time Complexity\u003c/th\u003e\n\u003cth\u003eSpatial Complexity\u003c/th\u003e\n\u003cth\u003eData Object Stability\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/BubbleSort.h\"\u003eBubble Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003eStable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/SelectionSort.h\"\u003eSelection Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003eThe array is unstable and the linked list is stable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/InsertSort.h\"\u003eInsert Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003eStable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/QuickSort.h\"\u003eQuick Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n*log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eUnstable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/HeapSort.cpp\"\u003eHeap Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n*log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eO(n*log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003eUnstable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/MergeSort.h\"\u003eMerge Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n*log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eO(n*log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eO(n)\u003c/td\u003e\n\u003ctd\u003eStable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/ShellSort.h\"\u003eShell Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n*log\u003csup\u003e2\u003c/sup\u003en)\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003eUnstable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/CountSort.cpp\"\u003eCount Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n+m)\u003c/td\u003e\n\u003ctd\u003eO(n+m)\u003c/td\u003e\n\u003ctd\u003eO(n+m)\u003c/td\u003e\n\u003ctd\u003eStable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/BucketSort.cpp\"\u003eBucket Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n)\u003c/td\u003e\n\u003ctd\u003eO(n)\u003c/td\u003e\n\u003ctd\u003eO(m)\u003c/td\u003e\n\u003ctd\u003eStable\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/RadixSort.h\"\u003eRadix Sort\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(k*n)\u003c/td\u003e\n\u003ctd\u003eO(n\u003csup\u003e2\u003c/sup\u003e)\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003eStable\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cblockquote\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAre arranged in ascending order\u003c/li\u003e\n\u003cli\u003ek: represents the number of \"digits\" in the value\u003c/li\u003e\n\u003cli\u003en: represents the size of the data\u003c/li\u003e\n\u003cli\u003em: represents the maximum value minus the minimum value of the data\u003c/li\u003e\n\u003cli\u003eFrom: \u003ca href=\"https://en.wikipedia.org/wiki/Sorting_algorithm\" rel=\"nofollow\"\u003ewikipedia. Sorting Algorithm\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFind\u003c/h3\u003e\u003ca id=\"user-content-find\" class=\"anchor\" aria-label=\"Permalink: Find\" href=\"#find\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eFind Algorithm\u003c/th\u003e\n\u003cth\u003eAverage Time Complexity\u003c/th\u003e\n\u003cth\u003eSpatial Complexity\u003c/th\u003e\n\u003cth\u003eFind Conditions\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/SequentialSearch.h\"\u003eSequentialSearch\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(n)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003esorted or unsorted\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/BinarySearch.h\"\u003eBinary search (half search)\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003esorted\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/InsertionSearch.h\"\u003eInsertion Search\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003e(log\u003csub\u003e2\u003c/sub\u003en))\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003esorted\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/FibonacciSearch.cpp\"\u003eFibonacci Search\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003esoted\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/HashTable.cpp\"\u003eHash Table\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(1)\u003c/td\u003e\n\u003ctd\u003eO(n)\u003c/td\u003e\n\u003ctd\u003esorted or unsorted\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/Algorithm/BSTSearch.h\"\u003eBinary Search Tree (BST Search)\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"/huihut/interview/blob/master/DataStructure/RedBlackTree.cpp\"\u003eRed Black Tree\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e2-3 Tree\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003en - log\u003csub\u003e3\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eB Tree/B+ Tree\u003c/td\u003e\n\u003ctd\u003eO(log\u003csub\u003e2\u003c/sub\u003en)\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGraph search algorithm\u003c/h3\u003e\u003ca id=\"user-content-graph-search-algorithm\" class=\"anchor\" aria-label=\"Permalink: Graph search algorithm\" href=\"#graph-search-algorithm\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eGraph Search Algorithm\u003c/th\u003e\n\u003cth\u003eData Structure\u003c/th\u003e\n\u003cth\u003eTraversal Time Complexity\u003c/th\u003e\n\u003cth\u003eSpatial Complexity\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://zh.wikipedia.org/wiki/%E5%B9%BF%E5%BA%A6%E4%BC%98%E5%85%88%E6%90%9C%E7%B4%A2\" rel=\"nofollow\"\u003eBFS - Breadth First Search\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eadjacency matrix \u003cbr\u003e adjacency list\u003c/td\u003e\n\u003ctd\u003eO(|v|\u003csup\u003e2\u003c/sup\u003e)\u003cbr\u003eO(|v|+|E|)\u003c/td\u003e\n\u003ctd\u003eO(|v|\u003csup\u003e2\u003c/sup\u003e)\u003cbr\u003eO(|v|+|E|)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://zh.wikipedia.org/wiki/%E6%B7%B1%E5%BA%A6%E4%BC%98%E5%85%88%E6%90%9C%E7%B4%A2\" rel=\"nofollow\"\u003eDFS - Depth-First Search\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eadjacency matrix \u003cbr\u003e adjacent linked list\u003c/td\u003e\n\u003ctd\u003eO(|v|\u003csup\u003e2\u003c/sup\u003e)\u003cbr\u003eO(|v|+|E|)\u003c/td\u003e\n\u003ctd\u003eO(|v|\u003csup\u003e2\u003c/sup\u003e)\u003cbr\u003eO(|v|+|E|)\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOther algorithms\u003c/h3\u003e\u003ca id=\"user-content-other-algorithms\" class=\"anchor\" aria-label=\"Permalink: Other algorithms\" href=\"#other-algorithms\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eAlgorithms\u003c/th\u003e\n\u003cth\u003eIdeas\u003c/th\u003e\n\u003cth\u003eApplications\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://en.wikipedia.org/wiki/%E5%88%86%E6%B2%BB%E6%B3%95\" rel=\"nofollow\"\u003eDivide and Conquer\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eDivide a complex problem into two or more The same or similar sub-problems, until the last sub-problem can be simply and directly solved, the solution of the original problem is the combination of the solutions of the sub-problems\u003c/td\u003e\n\u003ctd\u003e\u003ca href=\"https://github.com/huihut/interview/tree/master/Problems/RoundRobinProblem\"\u003eloop schedule problem\u003c/a\u003e, sorting algorithms (quick sort, merge sort)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://en.wikipedia.org/wiki/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92\" rel=\"nofollow\"\u003eDynamic Programming\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eBy decomposing the original problem into relative Simple sub-question way to solve complex problems, suitable for problems with overlapping sub-problems and optimal sub-structure properties\u003c/td\u003e\n\u003ctd\u003e[knapsack problem] KnapsackProblem), Fibonacci sequence\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https://en.wikipedia.org/wiki/%E8%B4%AA%E5%BF%83%E6%B3%95\" rel=\"nofollow\"\u003eGreedy method\u003c/a\u003e\u003c/td\u003e\n\u003ctd\u003eA kind of choice is taken in the current state in each step The best or optimal (that is, the most advantageous) choice, so that the result is the best or optimal algorithm\u003c/td\u003e\n\u003ctd\u003eTravel Salesman Problem (Shortest Path Problem), Minimum Spanning Tree, Huffman Coding\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-problems\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e❓ Problems\u003c/h2\u003e\u003ca id=\"user-content--problems\" class=\"anchor\" aria-label=\"Permalink: ❓ Problems\" href=\"#-problems\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSingle Problem\u003c/h3\u003e\u003ca id=\"user-content-single-problem\" class=\"anchor\" aria-label=\"Permalink: Single Problem\" href=\"#single-problem\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"/huihut/interview/blob/master/Problems/ChessboardCoverageProblem\"\u003eChessboard Coverage Problem (Checkerboard coverage problem)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/huihut/interview/blob/master/Problems/KnapsackProblem\"\u003eKnapsack Problem\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/huihut/interview/blob/master/Problems/NeumannNeighborProblem\"\u003eNeumann Neighbor Problem\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/huihut/interview/blob/master/Problems/RoundRobinProblem\"\u003eRound Robin Problem\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"/huihut/interview/blob/master/Problems/TubingProblem\"\u003eTubing Problem\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLeetcode Problems\u003c/h3\u003e\u003ca id=\"user-content-leetcode-problems\" class=\"anchor\" aria-label=\"Permalink: Leetcode Problems\" href=\"#leetcode-problems\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/haoel/leetcode\"\u003eGithub . haoel/leetcode\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/pezy/LeetCode\"\u003eGithub . pezy/LeetCode\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSword Finger Offer\u003c/h3\u003e\u003ca id=\"user-content-sword-finger-offer\" class=\"anchor\" aria-label=\"Permalink: Sword Finger Offer\" href=\"#sword-finger-offer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/zhedahht/CodingInterviewChinese2\"\u003eGithub . zhedahht/CodingInterviewChinese2\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/gatieme/CodingInterviews\"\u003eGithub . gatieme/CodingInterviews\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCracking the Coding Interview (Programmer Interview Gold)\u003c/h3\u003e\u003ca id=\"user-content-cracking-the-coding-interview-programmer-interview-gold\" class=\"anchor\" aria-label=\"Permalink: Cracking the Coding Interview (Programmer Interview Gold)\" href=\"#cracking-the-coding-interview-programmer-interview-gold\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/careercup/ctci\"\u003eGithub . careercup/ctci\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/ta/cracking-the-coding-interview\" rel=\"nofollow\"\u003eNiu Ke. Programmer interview golden code\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNiu Ke\u003c/h3\u003e\u003ca id=\"user-content-niu-ke\" class=\"anchor\" aria-label=\"Permalink: Niu Ke\" href=\"#niu-ke\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/activity/oj\" rel=\"nofollow\"\u003eNiu Ke . Online programming topics\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-os\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e💻 Operating system\u003c/h2\u003e\u003ca id=\"user-content--operating-system\" class=\"anchor\" aria-label=\"Permalink: 💻 Operating system\" href=\"#-operating-system\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eProcesses and threads\u003c/h3\u003e\u003ca id=\"user-content-processes-and-threads\" class=\"anchor\" aria-label=\"Permalink: Processes and threads\" href=\"#processes-and-threads\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFor threaded systems:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eProcesses are independent units of resource allocation\u003c/li\u003e\n\u003cli\u003eThread is an independent unit of resource scheduling\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eFor non-threaded systems:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eProcess is an independent unit of resource scheduling and allocation\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCommunication between processes and advantages and disadvantages\u003c/h4\u003e\u003ca id=\"user-content-communication-between-processes-and-advantages-and-disadvantages\" class=\"anchor\" aria-label=\"Permalink: Communication between processes and advantages and disadvantages\" href=\"#communication-between-processes-and-advantages-and-disadvantages\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePipeline (PIPE)\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFamous Pipeline: A half-duplex communication method that allows communication between unrelated processes\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAdvantages: can achieve inter-process communication in any relationship\u003c/li\u003e\n\u003cli\u003eDisadvantages:\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eLong-term storage in the system, improper use is prone to errors\nLimited buffer\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eUnnamed pipe: a half-duplex communication method that can only be used between processes with parental relationships (parent-child processes)\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAdvantages: simple and convenient\u003c/li\u003e\n\u003cli\u003eDisadvantages:\nLimited to one-way communication\n2. Can only be created between its processes and their related processes\n3. Limited buffer\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eSemaphore: a counter that can be used to control access to shared resources by multiple threads\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAdvantages: can synchronize processes\u003c/li\u003e\n\u003cli\u003eDisadvantage: limited semaphore\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eSignal (Signal): a more complex communication method used to notify the receiving process that an event has occurred\u003c/li\u003e\n\u003cli\u003eMessage Queue: a linked list of messages, stored in the kernel and identified by the message queue identifier\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAdvantages: can achieve communication between any process, and achieve synchronization between message sending and receiving through system call functions, no need to consider synchronization issues, convenient\u003c/li\u003e\n\u003cli\u003eDisadvantages: Copying information requires additional CPU time, which is not suitable for situations with large amounts of information or frequent operations\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eShared Memory: Maps a piece of memory that can be accessed by other processes. This shared memory is created by one process, but can be accessed by multiple processes.\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAdvantages: no need to copy, fast, large amount of information\u003c/li\u003e\n\u003cli\u003eDisadvantages:\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eCommunication is achieved by directly attaching the shared space buffer to the virtual address space of the process, so the synchronization of read and write operations between processes\u003c/li\u003e\n\u003cli\u003eUse the memory buffer to directly exchange information. The entity of memory exists in the computer and can only be shared with many processes in a computer system, which is not convenient for network communication.\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eSocket (Socket): can be used for process communication between different computers\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAdvantages:\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eThe transmission data is byte level, the transmission data can be customized, the data volume is small and the efficiency is high\u003c/li\u003e\n\u003cli\u003eShort data transmission time and high performance\u003c/li\u003e\n\u003cli\u003eSuitable for real-time information exchange between client and server\u003c/li\u003e\n\u003cli\u003eCan be encrypted, strong data security\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003cli\u003eDisadvantages: The transmitted data needs to be parsed and converted into application-level data.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCommunication between threads\u003c/h4\u003e\u003ca id=\"user-content-communication-between-threads\" class=\"anchor\" aria-label=\"Permalink: Communication between threads\" href=\"#communication-between-threads\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eLocking mechanism: including mutex, reader-writer lock, spin lock, and condition\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eMutex (mutex): Provides an exclusive way to prevent data structures from being modified concurrently.\u003c/li\u003e\n\u003cli\u003eReader-writer lock: Allow multiple threads to read shared data at the same time, and are mutually exclusive for write operations.\u003c/li\u003e\n\u003cli\u003eSpin locks are similar to mutex locks in order to protect shared resources. The mutex is when the resource is occupied and the applicant goes to sleep; the spin lock circularly detects whether the holder has released the lock.\u003c/li\u003e\n\u003cli\u003eCondition variable (condition): you can atomically block the process until a certain condition is true. Testing of conditions is performed under the protection of a mutex. Condition variables are always used with a mutex.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eSemaphore mechanism\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eUnknown thread semaphore\u003c/li\u003e\n\u003cli\u003eNamed thread semaphore\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eSignal mechanism (Signal): similar to signal processing between processes\u003c/li\u003e\n\u003cli\u003eBarrier: A barrier allows each thread to wait until all cooperating threads reach a certain point, and then continue execution from that point.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eThe purpose of communication between threads is mainly for thread synchronization, so threads have no communication mechanism for data exchange like in process communication.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eThe communication methods between processes and their advantages and disadvantages come from: \u003ca href=\"http://blog.csdn.net/wujiafei_njgcxy/article/details/77098977\" rel=\"nofollow\"\u003eProcess thread interview question summary\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePrivate and shared resources between processes\u003c/h4\u003e\u003ca id=\"user-content-private-and-shared-resources-between-processes\" class=\"anchor\" aria-label=\"Permalink: Private and shared resources between processes\" href=\"#private-and-shared-resources-between-processes\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePrivate: address space, heap, global variables, stack, registers\u003c/li\u003e\n\u003cli\u003eShare: code snippet, public data, process directory, process ID\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePrivate and shared resources between threads\u003c/h4\u003e\u003ca id=\"user-content-private-and-shared-resources-between-threads\" class=\"anchor\" aria-label=\"Permalink: Private and shared resources between threads\" href=\"#private-and-shared-resources-between-threads\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePrivate: thread stack, register, program counter\u003c/li\u003e\n\u003cli\u003eShared: heap, address space, global variables, static variables\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eComparison, advantages and disadvantages of multi-process and multi-thread\u003c/h4\u003e\u003ca id=\"user-content-comparison-advantages-and-disadvantages-of-multi-process-and-multi-thread\" class=\"anchor\" aria-label=\"Permalink: Comparison, advantages and disadvantages of multi-process and multi-thread\" href=\"#comparison-advantages-and-disadvantages-of-multi-process-and-multi-thread\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCompared\u003c/h5\u003e\u003ca id=\"user-content-compared\" class=\"anchor\" aria-label=\"Permalink: Compared\" href=\"#compared\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eContrast Dimensions\u003c/th\u003e\n\u003cth\u003eMulti-Process\u003c/th\u003e\n\u003cth\u003eMulti-Threaded\u003c/th\u003e\n\u003cth\u003eSummary\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eData sharing and synchronization\u003c/td\u003e\n\u003ctd\u003eComplex data sharing requires IPC; data is separate and easy to synchronize\u003c/td\u003e\n\u003ctd\u003eBecause process data is shared, data sharing is simple, but it is also because of this reason that synchronization is complicated\u003c/td\u003e\n\u003ctd\u003eEach advantage\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMemory, CPU\u003c/td\u003e\n\u003ctd\u003eOccupies more memory, complex switching, low CPU utilization\u003c/td\u003e\n\u003ctd\u003eLess memory, simple switching, high CPU utilization\u003c/td\u003e\n\u003ctd\u003eThreads dominate\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCreate destroy, switch\u003c/td\u003e\n\u003ctd\u003ecreate destroy, switch complex, slow speed\u003c/td\u003e\n\u003ctd\u003ecreate destroy, switch simple, fast speed\u003c/td\u003e\n\u003ctd\u003ethread dominant\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eProgramming, debugging\u003c/td\u003e\n\u003ctd\u003esimple programming, simple debugging\u003c/td\u003e\n\u003ctd\u003ecomplex programming, complex debugging\u003c/td\u003e\n\u003ctd\u003eprocess dominates\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eReliability\u003c/td\u003e\n\u003ctd\u003eProcesses will not affect each other\u003c/td\u003e\n\u003ctd\u003eHanging a thread will cause the entire process to hang\u003c/td\u003e\n\u003ctd\u003eProcess dominance\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eDistributed\u003c/td\u003e\n\u003ctd\u003eApplicable to multi-core, multi-machine distributed; if one machine is not enough, it is relatively simple to expand to multiple machines\u003c/td\u003e\n\u003ctd\u003eadapted to multi-core distributed\u003c/td\u003e\n\u003ctd\u003eprocess dominant\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePros and cons\u003c/h5\u003e\u003ca id=\"user-content-pros-and-cons\" class=\"anchor\" aria-label=\"Permalink: Pros and cons\" href=\"#pros-and-cons\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003ePros and cons\u003c/th\u003e\n\u003cth\u003emulti-process\u003c/th\u003e\n\u003cth\u003emulti-threaded\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eAdvantages\u003c/td\u003e\n\u003ctd\u003eSimple programming and debugging, high reliability\u003c/td\u003e\n\u003ctd\u003eFast creation, destruction, switching, small memory and resource occupation\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eDisadvantages\u003c/td\u003e\n\u003ctd\u003eCreating, destroying, slow switching, large memory and resource occupation\u003c/td\u003e\n\u003ctd\u003eComplex programming and debugging, poor reliability\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSelect\u003c/h5\u003e\u003ca id=\"user-content-select\" class=\"anchor\" aria-label=\"Permalink: Select\" href=\"#select\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eNeed to frequently create and destroy priority threads\u003c/li\u003e\n\u003cli\u003ePriority threads that require a lot of calculations\u003c/li\u003e\n\u003cli\u003eStrongly related processing threads, weakly related processing processes\u003c/li\u003e\n\u003cli\u003eMay be extended to multi-machine distributed processes, multi-core distributed threads\u003c/li\u003e\n\u003cli\u003eWhen all meet the needs, use the method you are most familiar with\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eThe comparison, advantages and disadvantages of multi-process and multi-thread come from: \u003ca href=\"https://blog.csdn.net/lishenglong666/article/details/8557215\" rel=\"nofollow\"\u003emulti-thread or multi-process selection and difference\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLinux kernel synchronization\u003c/h3\u003e\u003ca id=\"user-content-linux-kernel-synchronization\" class=\"anchor\" aria-label=\"Permalink: Linux kernel synchronization\" href=\"#linux-kernel-synchronization\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ethe reason\u003c/h4\u003e\u003ca id=\"user-content-the-reason\" class=\"anchor\" aria-label=\"Permalink: the reason\" href=\"#the-reason\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn modern operating systems, there may be multiple kernel execution streams executing at the same time, so the kernel actually needs some synchronization mechanism to synchronize the access of the execution units to shared data like multi-process and multi-thread programming. Especially on multiprocessor systems, some synchronization mechanisms are needed to synchronize the access of the execution units on different processors to shared data.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSynchronously\u003c/h4\u003e\u003ca id=\"user-content-synchronously\" class=\"anchor\" aria-label=\"Permalink: Synchronously\" href=\"#synchronously\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eAtomic operations\u003c/li\u003e\n\u003cli\u003eSemaphore\u003c/li\u003e\n\u003cli\u003eRead and write semaphore (rw_semaphore)\u003c/li\u003e\n\u003cli\u003eSpinlock\u003c/li\u003e\n\u003cli\u003eBig Kernel Lock (BKL, Big Kernel Lock)\u003c/li\u003e\n\u003cli\u003eRead-write lock (rwlock)\u003c/li\u003e\n\u003cli\u003eBrlock-Big Reader Lock\u003c/li\u003e\n\u003cli\u003eRead-Copy Update (RCU, Read-Copy Update)\u003c/li\u003e\n\u003cli\u003eSequence lock (seqlock)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eFrom: \u003ca href=\"https://www.ibm.com/developerworks/cn/linux/l-synch/part1/\" rel=\"nofollow\"\u003eLinux kernel synchronization mechanism, Part 1\u003c/a\u003e, \u003ca href=\"https://www.ibm.com/developerworks/cn/linux/l-synch/part2/\" rel=\"nofollow\"\u003eLinux kernel synchronization mechanism, Part 2\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDeadlock\u003c/h3\u003e\u003ca id=\"user-content-deadlock\" class=\"anchor\" aria-label=\"Permalink: Deadlock\" href=\"#deadlock\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eReasons\u003c/h4\u003e\u003ca id=\"user-content-reasons\" class=\"anchor\" aria-label=\"Permalink: Reasons\" href=\"#reasons\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eInsufficient system resources\u003c/li\u003e\n\u003cli\u003eImproper allocation of resources\u003c/li\u003e\n\u003cli\u003eThe progress order of the process operation is not suitable\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGenerate conditions\u003c/h4\u003e\u003ca id=\"user-content-generate-conditions\" class=\"anchor\" aria-label=\"Permalink: Generate conditions\" href=\"#generate-conditions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eMutex\u003c/li\u003e\n\u003cli\u003eRequest and hold\u003c/li\u003e\n\u003cli\u003eNot deprived\u003c/li\u003e\n\u003cli\u003eLoop\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePrevention\u003c/h4\u003e\u003ca id=\"user-content-prevention\" class=\"anchor\" aria-label=\"Permalink: Prevention\" href=\"#prevention\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBreaking mutually exclusive conditions: transforming exclusive resources into virtual resources, most of which cannot be transformed.\u003c/li\u003e\n\u003cli\u003eBreak the non-preemption condition: when a process occupies an exclusive resource and then applies for an exclusive resource that cannot be met, it will withdraw from the original resource.\u003c/li\u003e\n\u003cli\u003eBreak possession and apply conditions: Adopt a resource pre-allocation strategy, that is, apply for all resources before the process runs, run if it meets, or wait, so that it will not be occupied and applied.\u003c/li\u003e\n\u003cli\u003eBreak the loop waiting condition: implement the orderly allocation of resources, implement classification numbers for all devices, and all processes can only apply for resources in the form of increasing numbers.\u003c/li\u003e\n\u003cli\u003eOrdered resource allocation method\u003c/li\u003e\n\u003cli\u003eBanker Algorithm\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFile system\u003c/h3\u003e\u003ca id=\"user-content-file-system\" class=\"anchor\" aria-label=\"Permalink: File system\" href=\"#file-system\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eWindows: FCB table + FAT + bitmap\u003c/li\u003e\n\u003cli\u003eUnix: inode + mixed index + group link\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHost byte order and network byte order\u003c/h3\u003e\u003ca id=\"user-content-host-byte-order-and-network-byte-order\" class=\"anchor\" aria-label=\"Permalink: Host byte order and network byte order\" href=\"#host-byte-order-and-network-byte-order\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHost Endianness (CPU Endianness)\u003c/h4\u003e\u003ca id=\"user-content-host-endianness-cpu-endianness\" class=\"anchor\" aria-label=\"Permalink: Host Endianness (CPU Endianness)\" href=\"#host-endianness-cpu-endianness\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConcept\u003c/h5\u003e\u003ca id=\"user-content-concept-2\" class=\"anchor\" aria-label=\"Permalink: Concept\" href=\"#concept-2\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe host byte order is also called the CPU byte order. It is not determined by the operating system, but by the CPU instruction set architecture. There are two types of host byte order:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBig Endian: The high-order byte is stored in the low-order address, and the low-order byte is stored in the high-order address\u003c/li\u003e\n\u003cli\u003eLittle Endian: The high-order byte is stored in the high-order address, and the low-order byte is stored in the low-order address.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eStorage method\u003c/h5\u003e\u003ca id=\"user-content-storage-method\" class=\"anchor\" aria-label=\"Permalink: Storage method\" href=\"#storage-method\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe 32-bit integer \u003ccode\u003e0x12345678\u003c/code\u003e is stored from the address starting at\u003ccode\u003e 0x00\u003c/code\u003e, then:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eMemory address\u003c/th\u003e\n\u003cth\u003e0x00\u003c/th\u003e\n\u003cth\u003e0x01\u003c/th\u003e\n\u003cth\u003e0x02\u003c/th\u003e\n\u003cth\u003e0x03\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eBig Endian\u003c/td\u003e\n\u003ctd\u003e12\u003c/td\u003e\n\u003ctd\u003e34\u003c/td\u003e\n\u003ctd\u003e56\u003c/td\u003e\n\u003ctd\u003e78\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eLittle Endian\u003c/td\u003e\n\u003ctd\u003e78\u003c/td\u003e\n\u003ctd\u003e56\u003c/td\u003e\n\u003ctd\u003e34\u003c/td\u003e\n\u003ctd\u003e12\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eBig-endian little-endian pictures\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Big-Endian.svg.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Big-Endian.svg.png\" alt=\"Big endian\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Little-Endian.svg.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Little-Endian.svg.png\" alt=\"Little endian\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eJudging big-endian little-endian\u003c/h5\u003e\u003ca id=\"user-content-judging-big-endian-little-endian\" class=\"anchor\" aria-label=\"Permalink: Judging big-endian little-endian\" href=\"#judging-big-endian-little-endian\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eJudge big-endian little-endian\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eYou can determine whether your CPU byte order is big-endian or little-endian:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#include \u0026lt;iostream\u0026gt;\nusing namespace std;\n\nint main()\n{\n\tint i = 0x12345678;\n\n\tif (*((char*)\u0026amp;i) == 0x12)\n\t\tcout \u0026lt;\u0026lt; \u0026quot;Big endian\u0026quot; \u0026lt;\u0026lt; endl;\n\telse\t\n\t\tcout \u0026lt;\u0026lt; \u0026quot;Little endian\u0026quot; \u0026lt;\u0026lt; endl;\n\n\treturn 0;\n}\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eiostream\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e \u003cspan class=\"pl-k\"\u003enamespace\u003c/span\u003e \u003cspan class=\"pl-en\"\u003estd\u003c/span\u003e\u003cspan class=\"pl-k\"\u003e;\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e()\n{\n\t\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e i = \u003cspan class=\"pl-c1\"\u003e0x12345678\u003c/span\u003e;\n\n\t\u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (*((\u003cspan class=\"pl-k\"\u003echar\u003c/span\u003e*)\u0026amp;i) == \u003cspan class=\"pl-c1\"\u003e0x12\u003c/span\u003e)\n\t\tcout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eBig endian\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; endl;\n\t\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\t\n\t\tcout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eLittle endian\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; endl;\n\n\t\u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eByte order of each architecture processor\u003c/h5\u003e\u003ca id=\"user-content-byte-order-of-each-architecture-processor\" class=\"anchor\" aria-label=\"Permalink: Byte order of each architecture processor\" href=\"#byte-order-of-each-architecture-processor\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ex86 (Intel, AMD), MOS Technology 6502, Z80, VAX, PDP-11 and other processors are little-endian;\u003c/li\u003e\n\u003cli\u003eMotorola 6800, Motorola 68000, PowerPC 970, System/370, SPARC (except V9) processors are big-endian;\u003c/li\u003e\n\u003cli\u003eThe endianness of ARM (default little-endian), PowerPC (except PowerPC 970), DEC Alpha, SPARC V9, MIPS, PA-RISC, and IA64 are configurable.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNetwork byte order\u003c/h4\u003e\u003ca id=\"user-content-network-byte-order\" class=\"anchor\" aria-label=\"Permalink: Network byte order\" href=\"#network-byte-order\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eNetwork byte order is a data representation format specified in TCP/IP. It has nothing to do with the specific CPU type, operating system, etc., so that it can ensure that the data can be correctly interpreted when transmitted between different hosts.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe network byte order uses: Big Endian arrangement.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePage replacement algorithm\u003c/h3\u003e\u003ca id=\"user-content-page-replacement-algorithm\" class=\"anchor\" aria-label=\"Permalink: Page replacement algorithm\" href=\"#page-replacement-algorithm\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eDuring the address mapping process, if a page to be accessed is found not to be in memory, a page fault interrupt is generated. When a page fault occurs, if there is no free page in the operating system memory, the operating system must select a page in memory to move it out of memory in order to make room for the page that is about to be paged in. The rules used to select which pages to eliminate are called page replacement algorithms.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCategories\u003c/h4\u003e\u003ca id=\"user-content-categories-1\" class=\"anchor\" aria-label=\"Permalink: Categories\" href=\"#categories-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eGlobal replacement: replacement in the entire memory space\u003c/li\u003e\n\u003cli\u003ePartial replacement: Replace in this process\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAlgorithm\u003c/h4\u003e\u003ca id=\"user-content-algorithm\" class=\"anchor\" aria-label=\"Permalink: Algorithm\" href=\"#algorithm\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eGlobal:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eWorking set algorithm\u003c/li\u003e\n\u003cli\u003ePage rate replacement algorithm\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003ePartially:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eOptimal Replacement Algorithm (OPT)\u003c/li\u003e\n\u003cli\u003eFirst in, first out replacement algorithm (FIFO)\u003c/li\u003e\n\u003cli\u003eLeast Recently Used (LRU) Algorithm\u003c/li\u003e\n\u003cli\u003eClock replacement algorithm\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-computer-network\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e☁️ Computer Network\u003c/h2\u003e\u003ca id=\"user-content-️-computer-network\" class=\"anchor\" aria-label=\"Permalink: ☁️ Computer Network\" href=\"#️-computer-network\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eSome of the knowledge in this section comes from Computer Networking (7th Edition)\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003eComputer network architecture:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84.png\" alt=\"Computer Network Architecture\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRoles and protocols of each layer\u003c/h3\u003e\u003ca id=\"user-content-roles-and-protocols-of-each-layer\" class=\"anchor\" aria-label=\"Permalink: Roles and protocols of each layer\" href=\"#roles-and-protocols-of-each-layer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eLayered\u003c/th\u003e\n\u003cth\u003erole\u003c/th\u003e\n\u003cth\u003eprotocol\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003ePhysical layer\u003c/td\u003e\n\u003ctd\u003eTransmission of bits through the medium, determination of mechanical and electrical specifications (bits)\u003c/td\u003e\n\u003ctd\u003eRJ45, CLOCK, IEEE802.3 (repeaters, hubs)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eData link layer\u003c/td\u003e\n\u003ctd\u003eAssemble bits into frames and point-to-point delivery (Frame)\u003c/td\u003e\n\u003ctd\u003ePPP, FR, HDLC, VLAN, MAC (bridge, switch)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eNetwork layer\u003c/td\u003e\n\u003ctd\u003eResponsible for the transmission of data packets from source to sink and Internet interconnection (packets)\u003c/td\u003e\n\u003ctd\u003eIP, ICMP, ARP, RARP, OSPF, IPX, RIP, IGRP (router)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eTransport layer\u003c/td\u003e\n\u003ctd\u003eProvide end-to-end reliable message delivery and error recovery (Segment)\u003c/td\u003e\n\u003ctd\u003eTCP, UDP, SPX\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eSession layer\u003c/td\u003e\n\u003ctd\u003eEstablishing, managing, and terminating sessions (session protocol data unit SPDU)\u003c/td\u003e\n\u003ctd\u003eNFS, SQL, NETBIOS, RPC\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ePresentation Layer\u003c/td\u003e\n\u003ctd\u003eTranslate, Encrypt, and Compress Data (Representation Protocol Data Unit PPDU)\u003c/td\u003e\n\u003ctd\u003eJPEG, MPEG, ASII\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eApplication layer\u003c/td\u003e\n\u003ctd\u003eA means to allow access to the OSI environment (Application Protocol Data Unit APDU)\u003c/td\u003e\n\u003ctd\u003eFTP, DNS, Telnet, SMTP, HTTP, WWW, NFS\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePhysical layer\u003c/h3\u003e\u003ca id=\"user-content-physical-layer\" class=\"anchor\" aria-label=\"Permalink: Physical layer\" href=\"#physical-layer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eUnit of transmitted data: bit\u003c/li\u003e\n\u003cli\u003eData transmission system: source system (source point, sender)-\u0026gt; transmission system-\u0026gt; destination system (receiver, destination)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eaisle:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eUnidirectional channel (simplex channel): only one direction communication, no reverse direction interaction, such as broadcasting\u003c/li\u003e\n\u003cli\u003eTwo-way alternate communication (half-duplex communication): both parties of the communication can send messages, but cannot send or receive at the same time\u003c/li\u003e\n\u003cli\u003eTwo-way simultaneous communication (full-duplex communication): both parties of the communication can send and receive information at the same time\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eChannel multiplexing technology:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFrequency division multiplexing (FDM, Frequency Division Multiplexing): different users in different frequency bands, users use different bandwidth resources at the same time\u003c/li\u003e\n\u003cli\u003eTime Division Multiplexing (TDM): different users in different time slices in the same time period, all users occupy the same bandwidth at different times\u003c/li\u003e\n\u003cli\u003eWavelength Division Multiplexing (WDM): Frequency division multiplexing of light\u003c/li\u003e\n\u003cli\u003eCode Division Multiplexing (CDM): Different users use different codes and can use the same frequency band for communication at the same time\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003edata link layer\u003c/h3\u003e\u003ca id=\"user-content-data-link-layer\" class=\"anchor\" aria-label=\"Permalink: data link layer\" href=\"#data-link-layer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eMain channel:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePoint-to-point channel\u003c/li\u003e\n\u003cli\u003eBroadcast channel\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ePoint-to-point channel\u003c/h4\u003e\u003ca id=\"user-content-point-to-point-channel\" class=\"anchor\" aria-label=\"Permalink: Point-to-point channel\" href=\"#point-to-point-channel\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eData unit: frame\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eThree basic questions:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eEncapsulation: Encapsulate IP datagrams at the network layer into frames, \u003ccode\u003eSOH-data part-EOT\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eTransparent transmission: No matter what characters in the data part, it can be transmitted; it can be solved by byte padding method (escaping characters before conflicting characters)\u003c/li\u003e\n\u003cli\u003eError detection: reduce bit error rate (BER), widely use cyclic redundancy check (CRC, Cyclic Redundancy Check)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003ePoint-to-Point Protocol:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePoint-to-Point Protocol: The protocol used by the user computer to communicate with the ISP\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBroadcast Channel\u003c/h4\u003e\u003ca id=\"user-content-broadcast-channel\" class=\"anchor\" aria-label=\"Permalink: Broadcast Channel\" href=\"#broadcast-channel\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBroadcast communication:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eHardware address (physical address, MAC address)\u003c/li\u003e\n\u003cli\u003eUnicast frame (one-to-one): The MAC address of the received frame is the same as the hardware address of this station\u003c/li\u003e\n\u003cli\u003eBroadcast frame (one pair): frame sent to all stations on the local area network\u003c/li\u003e\n\u003cli\u003eMulticast frame (one-to-many): frame sent to some sites on the local area network\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNetwork layer\u003c/h3\u003e\u003ca id=\"user-content-network-layer\" class=\"anchor\" aria-label=\"Permalink: Network layer\" href=\"#network-layer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eIP (Internet Protocol, Internet Protocol) is a protocol designed for computer networks to communicate with each other.\u003c/li\u003e\n\u003cli\u003eARP (Address Resolution Protocol, Address Resolution Protocol)\u003c/li\u003e\n\u003cli\u003eICMP (Internet Control Message Protocol, Internet Control Message Protocol)\u003c/li\u003e\n\u003cli\u003eIGMP (Internet Group Management Protocol, Internet Group Management Protocol)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eIP Internet Protocol\u003c/h4\u003e\u003ca id=\"user-content-ip-internet-protocol\" class=\"anchor\" aria-label=\"Permalink: IP Internet Protocol\" href=\"#ip-internet-protocol\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIP address classification:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eIP address ::= (\u0026lt;network number\u0026gt;, \u0026lt;host number\u0026gt;)\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eIP address category\u003c/th\u003e\n\u003cth\u003enetwork number\u003c/th\u003e\n\u003cth\u003enetwork range\u003c/th\u003e\n\u003cth\u003ehost number\u003c/th\u003e\n\u003cth\u003eIP address range\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eClass A\u003c/td\u003e\n\u003ctd\u003e8bit, the first bit is fixed at 0\u003c/td\u003e\n\u003ctd\u003e0 —— 127\u003c/td\u003e\n\u003ctd\u003e24bit\u003c/td\u003e\n\u003ctd\u003e1.0.0.0 —— 127.255.255.255\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eClass B\u003c/td\u003e\n\u003ctd\u003e16bit, the first two bits are fixed at 10\u003c/td\u003e\n\u003ctd\u003e128.0 —— 191.255\u003c/td\u003e\n\u003ctd\u003e16bit\u003c/td\u003e\n\u003ctd\u003e128.0.0.0 —— 191.255.255.255\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eClass C\u003c/td\u003e\n\u003ctd\u003e24bit, the first three bits are fixed at 110\u003c/td\u003e\n\u003ctd\u003e192.0.0 —— 223.255.255\u003c/td\u003e\n\u003ctd\u003e8bit\u003c/td\u003e\n\u003ctd\u003e192.0.0.0 —— 223.255.255.255\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eClass D\u003c/td\u003e\n\u003ctd\u003eThe first four bits are fixed at 1110, followed by the multicast address\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eClass E\u003c/td\u003e\n\u003ctd\u003eThe first five digits are fixed at 11110, the latter are reserved for future use\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eIP datagram format:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/IP%E6%95%B0%E6%8D%AE%E6%8A%A5%E6%A0%BC%E5%BC%8F.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/IP%E6%95%B0%E6%8D%AE%E6%8A%A5%E6%A0%BC%E5%BC%8F.png\" alt=\"IP 数据报格式\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eICMP Internet Control Message Protocol\u003c/h4\u003e\u003ca id=\"user-content-icmp-internet-control-message-protocol\" class=\"anchor\" aria-label=\"Permalink: ICMP Internet Control Message Protocol\" href=\"#icmp-internet-control-message-protocol\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eICMP message format:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/ICMP%E6%8A%A5%E6%96%87%E6%A0%BC%E5%BC%8F.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/ICMP%E6%8A%A5%E6%96%87%E6%A0%BC%E5%BC%8F.png\" alt=\"ICMP message format\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eapplication:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePING (Packet InterNet Groper) to test connectivity between two hosts\u003c/li\u003e\n\u003cli\u003eTTL (Time To Live, time to live) This field specifies the maximum number of network segments that IP packets are allowed to pass before being dropped by the router.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eInterior Gateway Protocol\u003c/h4\u003e\u003ca id=\"user-content-interior-gateway-protocol\" class=\"anchor\" aria-label=\"Permalink: Interior Gateway Protocol\" href=\"#interior-gateway-protocol\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRIP (Routing Information Protocol, Routing Information Protocol)\u003c/li\u003e\n\u003cli\u003eOSPF (Open Sortest Path First)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eExternal gateway protocol\u003c/h4\u003e\u003ca id=\"user-content-external-gateway-protocol\" class=\"anchor\" aria-label=\"Permalink: External gateway protocol\" href=\"#external-gateway-protocol\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBGP (Border Gateway Protocol, Border Gateway Protocol)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eIP multicast\u003c/h4\u003e\u003ca id=\"user-content-ip-multicast\" class=\"anchor\" aria-label=\"Permalink: IP multicast\" href=\"#ip-multicast\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eIGMP (Internet Group Management Protocol, Internet Group Management Protocol)\u003c/li\u003e\n\u003cli\u003eMulticast routing protocol\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eVPN and NAT\u003c/h4\u003e\u003ca id=\"user-content-vpn-and-nat\" class=\"anchor\" aria-label=\"Permalink: VPN and NAT\" href=\"#vpn-and-nat\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eVPN (Virtual Private Network)\u003c/li\u003e\n\u003cli\u003eNAT (Network Address Translation, Network Address Translation)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhat does the routing table contain?\u003c/h4\u003e\u003ca id=\"user-content-what-does-the-routing-table-contain\" class=\"anchor\" aria-label=\"Permalink: What does the routing table contain?\" href=\"#what-does-the-routing-table-contain\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eNetwork ID (Network ID): It is the network ID of the destination address.\u003c/li\u003e\n\u003cli\u003eSubnet mask: used to determine the network to which the IP belongs\u003c/li\u003e\n\u003cli\u003eNext hop address / interface: It is the address of the next stop of the data on the journey sent to the destination address. Where interface points to the next hop (that is, the next route). The route in an autonomous system (AS) should contain all subnets in the area, and the default gateway (Network id: \u003ccode\u003e0.0.0.0\u003c/code\u003e, Netmask:\u003ccode\u003e 0.0.0.0\u003c/code\u003e) points to the exit of the autonomous system.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003eDepending on the application and implementation, the routing table may contain the following additional information:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eCost: It is the cost required to pass the path during data transmission.\u003c/li\u003e\n\u003cli\u003eQuality of service for routing\u003c/li\u003e\n\u003cli\u003eList of inbound / outbound connections to be filtered in the route\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTransport layer\u003c/h3\u003e\u003ca id=\"user-content-transport-layer\" class=\"anchor\" aria-label=\"Permalink: Transport layer\" href=\"#transport-layer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eprotocol:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eTCP (Transmission Control Protocol)\u003c/li\u003e\n\u003cli\u003eUDP (User Datagram Protocol, User Datagram Protocol)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eport:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eApplications\u003c/th\u003e\n\u003cth\u003eFTP\u003c/th\u003e\n\u003cth\u003eTELNET\u003c/th\u003e\n\u003cth\u003eSMTP\u003c/th\u003e\n\u003cth\u003eDNS\u003c/th\u003e\n\u003cth\u003eTFTP\u003c/th\u003e\n\u003cth\u003eHTTP\u003c/th\u003e\n\u003cth\u003eHTTPS\u003c/th\u003e\n\u003cth\u003eSNMP\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003ePort number\u003c/td\u003e\n\u003ctd\u003e21\u003c/td\u003e\n\u003ctd\u003e23\u003c/td\u003e\n\u003ctd\u003e25\u003c/td\u003e\n\u003ctd\u003e53\u003c/td\u003e\n\u003ctd\u003e69\u003c/td\u003e\n\u003ctd\u003e80\u003c/td\u003e\n\u003ctd\u003e443\u003c/td\u003e\n\u003ctd\u003e161\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP\u003c/h4\u003e\u003ca id=\"user-content-tcp\" class=\"anchor\" aria-label=\"Permalink: TCP\" href=\"#tcp\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eTCP (Transmission Control Protocol, Transmission Control Protocol) is a connection-oriented, reliable, byte stream-based transport layer communication protocol, and its transmission unit is a message segment.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eFeature:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eConnection oriented\u003c/li\u003e\n\u003cli\u003eOnly point-to-point (one-to-one) communication\u003c/li\u003e\n\u003cli\u003eReliable interaction\u003c/li\u003e\n\u003cli\u003eFull-duplex communication\u003c/li\u003e\n\u003cli\u003eByte stream oriented\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eHow TCP guarantees reliable transmission:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eConfirmation and timeout retransmission\u003c/li\u003e\n\u003cli\u003eReasonable fragmentation and ordering of data\u003c/li\u003e\n\u003cli\u003eflow control\u003c/li\u003e\n\u003cli\u003eCongestion control\u003c/li\u003e\n\u003cli\u003eData validation\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eTCP message structure\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8A%A5%E6%96%87.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8A%A5%E6%96%87.png\" alt=\"TCP Message\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTCP header\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E9%A6%96%E9%83%A8.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E9%A6%96%E9%83%A8.png\" alt=\"TCP header\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eTCP: Status Control Code (Code, Control Flag), which takes 6 bits and has the following meaning:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eURG: Urgent. When \u003ccode\u003eURG = 1\u003c/code\u003e , it indicates that the urgent pointer field is valid, which means that the packet is an urgent packet. It tells the system that there is urgent data in this segment and it should be transmitted as soon as possible (equivalent to high-priority data), and the Urgent Pointer field in the above figure will also be enabled.\u003c/li\u003e\n\u003cli\u003eACK: Acknowledge. The acknowledgment number field is valid only when \u003ccode\u003eACK = 1\u003c/code\u003e, which means this packet is an acknowledgment packet. When \u003ccode\u003eACK = 0\u003c/code\u003e, the confirmation number is invalid.\u003c/li\u003e\n\u003cli\u003ePSH: (Push function) If it is 1, the representative requires the other party to immediately transmit other corresponding packets in the buffer, without waiting for the buffer to be full before sending.\u003c/li\u003e\n\u003cli\u003eRST: Reset bit (Reset). When \u003ccode\u003eRST = 1\u003c/code\u003e, it indicates that a serious error occurred in the TCP connection (such as due to a host crash or other reasons). You must release the connection and then re-establish the transport connection.\u003c/li\u003e\n\u003cli\u003eSYN: Synchronous. When SYN is set to 1, it indicates that this is a connection request or connection acceptance message. Usually, the packet with the SYN flag indicates that \"active\" wants to connect to the other party.\u003c/li\u003e\n\u003cli\u003eFIN: Final bit, used to release a connection. When \u003ccode\u003eFIN = 1\u003c/code\u003e, it means that the data of the sending end of this segment has been sent, and it is required to release the transport connection.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUDP\u003c/h4\u003e\u003ca id=\"user-content-udp\" class=\"anchor\" aria-label=\"Permalink: UDP\" href=\"#udp\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eUDP (User Datagram Protocol, User Datagram Protocol) is a connectionless transport layer protocol in the OSI (Open System Interconnection) reference model, which provides a simple and unreliable information transfer service oriented to transactions, and its transmission unit Is a user datagram.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003efeature:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eno connection\u003c/li\u003e\n\u003cli\u003eBest efforts to deliver\u003c/li\u003e\n\u003cli\u003eMessage-oriented\u003c/li\u003e\n\u003cli\u003eNo congestion control\u003c/li\u003e\n\u003cli\u003eSupports one-to-one, one-to-many, many-to-one, and many-to-many interactive communication\u003c/li\u003e\n\u003cli\u003eSmall overhead\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eUDP message structure\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E6%8A%A5%E6%96%87.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E6%8A%A5%E6%96%87.png\" alt=\"UDP 报文\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eUDP 首部\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E9%A6%96%E9%83%A8.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E9%A6%96%E9%83%A8.png\" alt=\"UDP 首部\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eTCP/UDP Pictures from \u003ca href=\"https://github.com/JerryC8080/understand-tcp-udp\"\u003ehttps://github.com/JerryC8080/understand-tcp-udp\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDifference between TCP and UDP\u003c/h4\u003e\u003ca id=\"user-content-difference-between-tcp-and-udp\" class=\"anchor\" aria-label=\"Permalink: Difference between TCP and UDP\" href=\"#difference-between-tcp-and-udp\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eTCP connection-oriented, UDP is connectionless;\u003c/li\u003e\n\u003cli\u003eTCP provides reliable service, that is, the data transmitted through the TCP connection is error-free, not lost, not duplicated, and arrives in order; UDP does its best to deliver, that is, it does not guarantee reliable delivery\u003c/li\u003e\n\u003cli\u003eTCP logical communication channel is a full-duplex reliable channel; UDP is an unreliable channel\u003c/li\u003e\n\u003cli\u003eEach TCP connection can only be point-to-point; UDP supports one-to-one, one-to-many, many-to-one and many-to-many interactive communication\u003c/li\u003e\n\u003cli\u003eTCP is oriented to byte streams (probably sticky packets may occur). In fact, TCP treats data as a series of unstructured byte streams; UDP is message-oriented (no sticky packets will occur)\u003c/li\u003e\n\u003cli\u003eUDP has no congestion control, so congestion on the network will not reduce the sending rate of the source host (useful for real-time applications, such as IP phones, real-time video conferencing, etc.)\u003c/li\u003e\n\u003cli\u003eTCP header overhead is 20 bytes; UDP header overhead is small, only 8 bytes\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP Sticky Packet\u003c/h4\u003e\u003ca id=\"user-content-tcp-sticky-packet\" class=\"anchor\" aria-label=\"Permalink: TCP Sticky Packet\" href=\"#tcp-sticky-packet\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ethe reason\u003c/h5\u003e\u003ca id=\"user-content-the-reason-1\" class=\"anchor\" aria-label=\"Permalink: the reason\" href=\"#the-reason-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTCP is a byte stream-based transmission service (UDP is message-based). \"Stream\" means that the data transmitted by TCP has no boundaries. So there may be situations where two data packets stick together.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSolve\u003c/h5\u003e\u003ca id=\"user-content-solve\" class=\"anchor\" aria-label=\"Permalink: Solve\" href=\"#solve\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSend fixed-length packets. If the size of each message is the same, the receiving peer only needs to accumulate the received data until the data is equal to a fixed-length value and treats it as a message.\u003c/li\u003e\n\u003cli\u003eBaotou plus package body length. The header is 4 bytes of fixed length, which indicates the length of the packet body. The receiving peer first receives the header length and receives the packet body according to the header length.\u003c/li\u003e\n\u003cli\u003eSet boundaries between packets, such as adding special symbols \u003ccode\u003e\\r\\n\u003c/code\u003e mark. The FTP protocol does just that. The problem is that if the data body also contains \u003ccode\u003e\\r\\n\u003c/code\u003e , it will be misjudged as the message boundary.\u003c/li\u003e\n\u003cli\u003eUse more complex application layer protocols.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP Flow Control\u003c/h4\u003e\u003ca id=\"user-content-tcp-flow-control\" class=\"anchor\" aria-label=\"Permalink: TCP Flow Control\" href=\"#tcp-flow-control\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConcept\u003c/h5\u003e\u003ca id=\"user-content-concept-3\" class=\"anchor\" aria-label=\"Permalink: Concept\" href=\"#concept-3\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eFlow control is to make the sending rate of the sender not too fast, but to allow the receiver to receive it.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMethods\u003c/h5\u003e\u003ca id=\"user-content-methods\" class=\"anchor\" aria-label=\"Permalink: Methods\" href=\"#methods\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eVariable window for flow control\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E5%88%A9%E7%94%A8%E5%8F%AF%E5%8F%98%E7%AA%97%E5%8F%A3%E8%BF%9B%E8%A1%8C%E6%B5%81%E9%87%8F%E6%8E%A7%E5%88%B6%E4%B8%BE%E4%BE%8B.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E5%88%A9%E7%94%A8%E5%8F%AF%E5%8F%98%E7%AA%97%E5%8F%A3%E8%BF%9B%E8%A1%8C%E6%B5%81%E9%87%8F%E6%8E%A7%E5%88%B6%E4%B8%BE%E4%BE%8B.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP congestion control\u003c/h4\u003e\u003ca id=\"user-content-tcp-congestion-control\" class=\"anchor\" aria-label=\"Permalink: TCP congestion control\" href=\"#tcp-congestion-control\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConcept\u003c/h5\u003e\u003ca id=\"user-content-concept-4\" class=\"anchor\" aria-label=\"Permalink: Concept\" href=\"#concept-4\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eCongestion control is to prevent excessive data from being injected into the network, so that the routers or links in the network will not be overloaded.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMethods\u003c/h5\u003e\u003ca id=\"user-content-methods-1\" class=\"anchor\" aria-label=\"Permalink: Methods\" href=\"#methods-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSlow start\u003c/li\u003e\n\u003cli\u003eCongestion avoidance\u003c/li\u003e\n\u003cli\u003eFast retransmit\u003c/li\u003e\n\u003cli\u003eFast recovery\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eTCP Congestion control graph\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8B%A5%E5%A1%9E%E7%AA%97%E5%8F%A3cwnd%E5%9C%A8%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%97%B6%E7%9A%84%E5%8F%98%E5%8C%96%E6%83%85%E5%86%B5.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8B%A5%E5%A1%9E%E7%AA%97%E5%8F%A3cwnd%E5%9C%A8%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%97%B6%E7%9A%84%E5%8F%98%E5%8C%96%E6%83%85%E5%86%B5.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E5%BF%AB%E9%87%8D%E4%BC%A0%E7%A4%BA%E6%84%8F%E5%9B%BE.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/%E5%BF%AB%E9%87%8D%E4%BC%A0%E7%A4%BA%E6%84%8F%E5%9B%BE.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%B5%81%E7%A8%8B%E5%9B%BE.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%B5%81%E7%A8%8B%E5%9B%BE.png\" alt=\"\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP Transmission connection management\u003c/h4\u003e\u003ca id=\"user-content-tcp-transmission-connection-management\" class=\"anchor\" aria-label=\"Permalink: TCP Transmission connection management\" href=\"#tcp-transmission-connection-management\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e因为 TCP 三次握手建立连接、四次挥手释放连接很重要,所以附上《计算机网络(第 7 版)-谢希仁》书中对此章的详细描述:\u003ca href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP-transport-connection-management.png\" rel=\"nofollow\"\u003ehttps://raw.githubusercontent.com/huihut/interview/master/images/TCP-transport-connection-management.png\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP 三次握手建立连接\u003c/h5\u003e\u003ca id=\"user-content-tcp-三次握手建立连接\" class=\"anchor\" aria-label=\"Permalink: TCP 三次握手建立连接\" href=\"#tcp-三次握手建立连接\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%BB%BA%E7%AB%8B%E8%BF%9E%E6%8E%A5.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%BB%BA%E7%AB%8B%E8%BF%9E%E6%8E%A5.png\" alt=\"UDP 报文\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e【Explain the whole process of TCP connection establishment】\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eThe client sends a SYN to the server, indicating that the client requests to establish a connection;\u003c/li\u003e\n\u003cli\u003eThe server receives the SYN sent by the client and replies with SYN + ACK to the client (agreeing to establish a connection);\u003c/li\u003e\n\u003cli\u003eAfter receiving the SYN + ACK from the server, the client responds with an ACK to the server (indicating that the client received the consent message sent by the server);\u003c/li\u003e\n\u003cli\u003eThe server receives the ACK from the client, the connection is established, and data transmission is possible.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhy does TCP have to shake hands three times?\u003c/h5\u003e\u003ca id=\"user-content-why-does-tcp-have-to-shake-hands-three-times\" class=\"anchor\" aria-label=\"Permalink: Why does TCP have to shake hands three times?\" href=\"#why-does-tcp-have-to-shake-hands-three-times\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e【Answer One】 Because the channel is unreliable, and TCP wants to establish a reliable transmission on the unreliable channel, then three communications is the theoretical minimum. (And UDP does not need to establish a reliable transmission, so UDP does not require a three-way handshake.)\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://groups.google.com/forum/#!msg/pongba/kF6O7-MFxM0/5S7zIJ4yqKUJ\" rel=\"nofollow\"\u003eGoogle Groups. Why is TCP a three-way handshake to establish a connection? {Technology} {Network Communication}\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003e[Answer II] Because both parties need to confirm that the other party has received the serial number sent by themselves, the confirmation process requires at least three communications.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://www.zhihu.com/question/24853633/answer/115173386\" rel=\"nofollow\"\u003eKnow. Why is TCP a three-way handshake instead of two or four? \u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003e[Answer three] In order to prevent the invalid connection request segment from being sent to the server suddenly, an error is generated.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP-transport-connection-management.png\" rel=\"nofollow\"\u003e\"Computer Network (7th Edition) -Xie Xiren\"\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP Four waves to release the connection\u003c/h5\u003e\u003ca id=\"user-content-tcp-four-waves-to-release-the-connection\" class=\"anchor\" aria-label=\"Permalink: TCP Four waves to release the connection\" href=\"#tcp-four-waves-to-release-the-connection\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B%E9%87%8A%E6%94%BE%E8%BF%9E%E6%8E%A5.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B%E9%87%8A%E6%94%BE%E8%BF%9E%E6%8E%A5.png\" alt=\"UDP 报文\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e【TCP Four waves to release the connection】\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eThe client sends FIN to the server, indicating that the client does not need to send data to the server (request to release the connection from the client to the server);\u003c/li\u003e\n\u003cli\u003eThe server receives the FIN sent by the client and replies ACK to the client (agreeing to release the connection from the client to the server);\u003c/li\u003e\n\u003cli\u003eThe client receives the ACK from the server, and the connection from the client to the server has been released (but the connection from the server to the client has not been released, and the client can still receive data);\u003c/li\u003e\n\u003cli\u003eThe server continues to send the unfinished data to the client;\u003c/li\u003e\n\u003cli\u003eThe server sends FIN + ACK to the client, indicating that the server has sent the data (request to release the connection from the server to the client, even if no reply is received from the client, it will be automatically released after a certain period of time);\u003c/li\u003e\n\u003cli\u003eThe client receives the FIN + ACK from the server and replies to the server with an ACK (agreeing to release the connection from the server to the client);\u003c/li\u003e\n\u003cli\u003eAfter receiving the ACK from the client, the server releases the connection from the server to the client.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWhy does TCP have to wave four times?\u003c/h5\u003e\u003ca id=\"user-content-why-does-tcp-have-to-wave-four-times\" class=\"anchor\" aria-label=\"Permalink: Why does TCP have to wave four times?\" href=\"#why-does-tcp-have-to-wave-four-times\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[Question 1] Why does TCP wave four times? / Why does TCP need three times to establish a connection and four times to release a connection?\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e[Answer One] Because TCP is in full-duplex mode, after the client requests to close the connection, the connection from the client to the server is closed (one or two waves), and the server continues to transmit the data that has not been previously transmitted to the client (data transmission) , The connection from the server to the client is closed (waving three or four times). Therefore, when TCP releases the connection, the server's ACK and FIN are sent separately (with data transmission in between), and when the TCP establishes the connection, the server's ACK and SYN are sent together (second handshake), so TCP needs to establish the connection three times. It takes four times to release the connection.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e[Question 2] Why can ACK and SYN be sent together when TCP is connected, and ACK and FIN are sent separately when released? (ACK and FIN refer to the second and third wave)\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e[Answer 2:] When the client requests the release, the server may still have data to transmit to the client, so the server must respond to the client FIN request (the server sends an ACK), and then the data is transmitted. After the transmission is completed, the server then Make a FIN request (the server sends FIN); there is no intermediate data transmission when connecting, so ACK and SYN can be sent together when connecting.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e[Question three] Why does the client need TIME-WAIT to wait for 2MSL at the end?\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e【Answer three】\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eIn order to ensure that the last ACK message sent by the client can reach the server. If it fails to arrive, the server will retransmit the FIN + ACK segment overtime, and the client will retransmit the ACK and re-time.\u003c/li\u003e\n\u003cli\u003ePrevent invalid connection request segments from appearing in this connection. When TIME-WAIT lasts 2MSL, all the segments generated during the duration of this connection will disappear from the network, so that the old connection segments will not appear in the next connection.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP finite state machine\u003c/h4\u003e\u003ca id=\"user-content-tcp-finite-state-machine\" class=\"anchor\" aria-label=\"Permalink: TCP finite state machine\" href=\"#tcp-finite-state-machine\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eTCP finite state machine picture\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%9C%89%E9%99%90%E7%8A%B6%E6%80%81%E6%9C%BA.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%9C%89%E9%99%90%E7%8A%B6%E6%80%81%E6%9C%BA.png\" alt=\"TCP Finite state machine\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eApplication layer\u003c/h3\u003e\u003ca id=\"user-content-application-layer\" class=\"anchor\" aria-label=\"Permalink: Application layer\" href=\"#application-layer\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDNS\u003c/h4\u003e\u003ca id=\"user-content-dns\" class=\"anchor\" aria-label=\"Permalink: DNS\" href=\"#dns\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eDNS (Domain Name System) is a service of the Internet. It serves as a distributed database that maps domain names and IP addresses to each other, enabling people to access the Internet more conveniently. DNS uses TCP and UDP port 53. Currently, the limit for the length of each domain name is 63 characters, and the total length of the domain name cannot exceed 253 characters.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003edomain name:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eDomain name :: = {\u0026lt;third-level domain name\u0026gt;.\u0026lt;Second-level domain name\u0026gt;.\u0026lt;Top-level domain name\u0026gt;}\u003c/code\u003e, for example: \u003ccode\u003eblog.huihut.com\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFTP\u003c/h4\u003e\u003ca id=\"user-content-ftp\" class=\"anchor\" aria-label=\"Permalink: FTP\" href=\"#ftp\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFTP (File Transfer Protocol, file transfer protocol) is a set of standard protocols for file transfer on the network, using the client / server model, using TCP datagrams, providing interactive access, two-way transmission.\u003c/li\u003e\n\u003cli\u003eTFTP (Trivial File Transfer Protocol) is a small and easy-to-implement file transfer protocol. It also uses the client-server method and uses UDP datagrams. It only supports file transfers and does not support interaction. User authentication\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTELNET\u003c/h4\u003e\u003ca id=\"user-content-telnet\" class=\"anchor\" aria-label=\"Permalink: TELNET\" href=\"#telnet\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eThe TELNET protocol is a member of the TCP / IP protocol family and is the standard protocol and main method of the Internet remote login service. It provides users with the ability to complete remote host work on the local computer.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eHTTP (HyperText Transfer Protocol) is a transfer protocol used to transfer hypertext from a WWW (World Wide Web, World Wide Web) server to a local browser.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eSMTP (Simple Mail Transfer Protocol) is a set of rules for transferring mail from the source address to the destination address, which controls the transfer method of the letter. The SMTP protocol belongs to the TCP / IP protocol suite, which helps each computer find the next destination when sending or transferring letters.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp dir=\"auto\"\u003eSocket requires at least a pair of port numbers (Socket) to establish a network communication connection. Socket is essentially a programming interface (API), which encapsulates TCP / IP. TCP / IP also provides an interface that programmers can use for network development. This is the Socket programming interface.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWWW\u003c/h4\u003e\u003ca id=\"user-content-www\" class=\"anchor\" aria-label=\"Permalink: WWW\" href=\"#www\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eWWW (World Wide Web, World Wide Web, World Wide Web) is a system composed of many hypertext links to each other, accessed via the Internet\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eURL\u003c/h5\u003e\u003ca id=\"user-content-url\" class=\"anchor\" aria-label=\"Permalink: URL\" href=\"#url\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eURL (Uniform Resource Locator) is a standard resource address (Address) on the Internet\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003estandard format:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eProtocol type: [// server address [: port number]] [/ resource level UNIX file path] file name [? Query] [# Clip ID]\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003eComplete format:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eProtocol type: [// [Credential information required to access resources @] server address [: port number]] [/ resource level UNIX file path] file name [? Query] [# segment ID]\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eAmong them [access credential information @ ;: port number ;? query; #fragment ID] are all optional items\nFor example: \u003ccode\u003ehttps://github.com/huihut/interview#cc\u003c/code\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHTTP\u003c/h5\u003e\u003ca id=\"user-content-http\" class=\"anchor\" aria-label=\"Permalink: HTTP\" href=\"#http\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHypertext Transfer Protocol (HTTP) is an application-layer protocol for distributed, collaborative, and hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eRequest method\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eMethod\u003c/th\u003e\n\u003cth\u003emeaning\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eOPTIONS\u003c/td\u003e\n\u003ctd\u003eRequest some option information to allow clients to view server performance\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eGET\u003c/td\u003e\n\u003ctd\u003eRequest the specified page information and return the entity body\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eHEAD\u003c/td\u003e\n\u003ctd\u003eSimilar to a get request, except that there is no specific content in the returned response, which is used to get the header\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ePOST\u003c/td\u003e\n\u003ctd\u003eSubmits data to a specified resource for processing requests (such as submitting a form or uploading a file). The data is contained in the request body. POST requests may result in the creation of new resources and / or modification of existing resources\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003ePUT\u003c/td\u003e\n\u003ctd\u003eData transmitted from the client to the server replaces the contents of the specified document\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eDELETE\u003c/td\u003e\n\u003ctd\u003erequest the server to delete the specified page\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eTRACE\u003c/td\u003e\n\u003ctd\u003eecho requests received by the server, mainly for testing or diagnostics\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cp dir=\"auto\"\u003eStatus Code\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e1xx: indicates notification information, such as the request has been received or is being processed\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e100 Continue: Continue, the client should continue its request\u003c/li\u003e\n\u003cli\u003e101 Switching Protocols. The server switches protocols according to the client's request. Can only switch to higher-level protocols, for example, to new versions of HTTP\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e2xx: indicates success, such as receiving or knowing\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e200 OK: The request was successful\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e3xx: indicates a redirect, and further action is required to complete the request\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e301 Moved Permanently: Move permanently. The requested resource has been permanently moved to the new URL, the returned information will include the new URL, and the browser will automatically be directed to the new URL. Any future requests should use the new URL instead\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e4xx: indicates a customer error, such as incorrect syntax in the request or inability to complete\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e400 Bad Request: The client requested a syntax error that the server could not understand\u003c/li\u003e\n\u003cli\u003e401 Unauthorized: request requires user authentication\u003c/li\u003e\n\u003cli\u003e403 Forbidden: The server understood the request from the requesting client, but refused to execute the request (insufficient permissions)\u003c/li\u003e\n\u003cli\u003e404 Not Found: The server cannot find the resource (web page) based on the client's request. With this code, the website designer can set a personality page for \"the resource you requested could not be found\"\u003c/li\u003e\n\u003cli\u003e408 Request Timeout: The server waited too long for the request sent by the client, timed out\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e5xx: indicates a server error, such as the server failing to complete the request\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e500 Internal Server Error: Server internal error, unable to complete request\u003c/li\u003e\n\u003cli\u003e503 Service Unavailable: Due to overload or system maintenance, the server cannot temporarily process the client's request. The length of the delay can be included in the server's Retry-After header\u003c/li\u003e\n\u003cli\u003e504 Gateway Timeout: The server acting as a gateway or proxy, not receiving requests from the remote server in a timely manner\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eMore status codes: \u003ca href=\"http://www.runoob.com/http/http-status-codes.html\" rel=\"nofollow\"\u003eRookie Tutorials. HTTP Status Codes\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOther agreements\u003c/h5\u003e\u003ca id=\"user-content-other-agreements\" class=\"anchor\" aria-label=\"Permalink: Other agreements\" href=\"#other-agreements\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSMTP (Simple Main Transfer Protocol, Simple Mail Transfer Protocol) is a standard for transmitting Email over the Internet. It is a relatively simple text-based protocol. One or more recipients of a message are specified on top of it (confirmed to exist in most cases), and the message text is transmitted. You can easily test an SMTP server through a Telnet program. SMTP uses TCP port 25.\u003c/li\u003e\n\u003cli\u003eDHCP (Dynamic Host Configuration Protocol) is a network protocol for a local area network. It uses the UDP protocol to work and has two main purposes:\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFor internal network or network service provider to automatically assign IP addresses to users\u003c/li\u003e\n\u003cli\u003eFor internal network administrators as a means of central management of all computers\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eSNMP (Simple Network Management Protocol) forms part of the Internet protocol family defined by the Internet Engineering Task Force (IETF). The protocol can support a network management system to monitor whether the devices connected to the network have any management concerns.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-network-programming\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e🌩 Network Programming\u003c/h2\u003e\u003ca id=\"user-content--network-programming\" class=\"anchor\" aria-label=\"Permalink: 🌩 Network Programming\" href=\"#-network-programming\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSocket\u003c/h3\u003e\u003ca id=\"user-content-socket\" class=\"anchor\" aria-label=\"Permalink: Socket\" href=\"#socket\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://www.cnblogs.com/skynet/archive/2010/12/12/1903949.html\" rel=\"nofollow\"\u003eLinux Socket Programming (unlimited Linux)\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/socket%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%80%9A%E8%AE%AF.jpg\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/socket%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%80%9A%E8%AE%AF.jpg\" alt=\"Socket Client server communication\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSocket middle read()、write() function\u003c/h4\u003e\u003ca id=\"user-content-socket-middle-readwrite-function\" class=\"anchor\" aria-label=\"Permalink: Socket middle read()、write() function\" href=\"#socket-middle-readwrite-function\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"ssize_t read(int fd, void *buf, size_t count);\nssize_t write(int fd, const void *buf, size_t count);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c1\"\u003essize_t\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eread\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e fd, \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e *buf, \u003cspan class=\"pl-c1\"\u003esize_t\u003c/span\u003e count);\n\u003cspan class=\"pl-c1\"\u003essize_t\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ewrite\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e fd, \u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e *buf, \u003cspan class=\"pl-c1\"\u003esize_t\u003c/span\u003e count);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eread()\u003c/h5\u003e\u003ca id=\"user-content-read\" class=\"anchor\" aria-label=\"Permalink: read()\" href=\"#read\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe read function is responsible for reading content from fd.\u003c/li\u003e\n\u003cli\u003eWhen the read is successful, read returns the actual number of bytes read.\u003c/li\u003e\n\u003cli\u003eIf the returned value is 0, it means that the end of the file has been read, and if it is less than 0, an error has occurred.\u003c/li\u003e\n\u003cli\u003eIf the error is EINTR, the reading is caused by interruption; if it is ECONNREST, there is a problem with the network connection.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ewrite ()\u003c/h5\u003e\u003ca id=\"user-content-write-\" class=\"anchor\" aria-label=\"Permalink: write ()\" href=\"#write-\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eThe write function writes the contents of nbytes in buf to the file descriptor fd.\u003c/li\u003e\n\u003cli\u003eReturns the number of bytes written when successful. On failure, it returns -1 and sets the errno variable.\u003c/li\u003e\n\u003cli\u003eIn network programs, there are two possibilities when we write to the socket file descriptor.\u003c/li\u003e\n\u003cli\u003e(1) The return value of write is greater than 0, indicating that part or all of the data has been written.\u003c/li\u003e\n\u003cli\u003e(2) The returned value is less than 0, and an error has occurred at this time.\u003c/li\u003e\n\u003cli\u003eIf the error is EINTR, it indicates that an interruption error occurred during writing; if it is EPIPE, it indicates that there is a problem with the network connection (the other party has closed the connection).\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP three-way handshake in socket to establish connection\u003c/h4\u003e\u003ca id=\"user-content-tcp-three-way-handshake-in-socket-to-establish-connection\" class=\"anchor\" aria-label=\"Permalink: TCP three-way handshake in socket to establish connection\" href=\"#tcp-three-way-handshake-in-socket-to-establish-connection\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWe know that TCP establishes a connection by performing a \"three-way handshake\", that is, exchanging three packets. The general process is as follows:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eThe client sends a SYN J to the server\u003c/li\u003e\n\u003cli\u003eThe server responds to the client with a SYN K, and confirms SYN J ACK J + 1\u003c/li\u003e\n\u003cli\u003eThe client wants the server to send an acknowledgement ACK K + 1\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003eOnly the three-way handshake is finished, but what about the three-way handshake in the socket function? Please see the picture below:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/a26c11ef7b59f36bb6ab2616cd9bcdd5e241958e1123b35b5272174b9c9de899/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373436373235382e706e67\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/a26c11ef7b59f36bb6ab2616cd9bcdd5e241958e1123b35b5272174b9c9de899/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373436373235382e706e67\" alt=\"socket Sent in TCP Three handshake\" data-canonical-src=\"http://images.cnblogs.com/cnblogs_com/skynet/201012/201012122157467258.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIt can be seen from the figure:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eWhen the client calls connect, a connection request is triggered and a SYN J packet is sent to the server. At this time, connect enters a blocking state;\u003c/li\u003e\n\u003cli\u003eThe server listens to the connection request, that is, receives the SYN J packet, calls the accept function to receive the request and sends SYN K and ACK J + 1 to the client, then accept enters the blocking state;\u003c/li\u003e\n\u003cli\u003eAfter the client receives the SYN K of the server, ACK J + 1, connect returns at this time, and confirms the SYN K;\u003c/li\u003e\n\u003cli\u003eWhen the server receives ACK K + 1, accept returns, so that the three handshake is completed and the connection is established.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTCP four-way handshake in socket to release connection\u003c/h4\u003e\u003ca id=\"user-content-tcp-four-way-handshake-in-socket-to-release-connection\" class=\"anchor\" aria-label=\"Permalink: TCP four-way handshake in socket to release connection\" href=\"#tcp-four-way-handshake-in-socket-to-release-connection\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe above describes the three-way handshake establishment process of TCP in socket and the socket functions involved. Now we introduce the process of releasing the connection by the four-way handshake in the socket, please see the following figure:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://camo.githubusercontent.com/72145f6906c6fe8b825866a209809d5a33f4d144f76c5e7ccabfd489d70fba89/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373438373631362e706e67\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/72145f6906c6fe8b825866a209809d5a33f4d144f76c5e7ccabfd489d70fba89/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373438373631362e706e67\" alt=\"socket TCP four-way handshake sent in\" data-canonical-src=\"http://images.cnblogs.com/cnblogs_com/skynet/201012/201012122157487616.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe illustrated process is as follows:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eAn application process first calls close to actively close the connection, then TCP sends a FIN M;\u003c/li\u003e\n\u003cli\u003eAfter receiving the FIN M, the other end performs a passive close to confirm the FIN. Its reception is also passed to the application process as an end-of-file character, because the reception of FIN means that the application process can no longer receive additional data on the corresponding connection;\u003c/li\u003e\n\u003cli\u003eAfter a period of time, the application process that received the end-of-file character calls close to close its socket. This causes its TCP to also send a FIN N;\u003c/li\u003e\n\u003cli\u003eThe source TCP that received the FIN confirms it.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp dir=\"auto\"\u003eSo there is a FIN and ACK in each direction.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-database\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e💾 Database\u003c/h2\u003e\u003ca id=\"user-content--database\" class=\"anchor\" aria-label=\"Permalink: 💾 Database\" href=\"#-database\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003ePart of the knowledge in this section comes from \"Introduction to Database Systems (5th Edition)\"\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ebasic concepts\u003c/h3\u003e\u003ca id=\"user-content-basic-concepts\" class=\"anchor\" aria-label=\"Permalink: basic concepts\" href=\"#basic-concepts\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eData: Symbolic records describing things are called data.\u003c/li\u003e\n\u003cli\u003eDatabase (DB): It is a collection of a large amount of organized, shareable data stored in a computer for a long time, and has three basic characteristics of permanent storage, organization, and shareability.\u003c/li\u003e\n\u003cli\u003eDatabase Management System (DBMS): is a layer of data management software located between the user and the operating system.\u003c/li\u003e\n\u003cli\u003eDatabase system (DBS): is a system consisting of a database, a database management system (and its application development tools), applications, and a database administrator (DBA) to store, manage, process, and maintain data.\u003c/li\u003e\n\u003cli\u003eEntity: Objects that exist objectively and can be distinguished from each other are called entities.\u003c/li\u003e\n\u003cli\u003eAttribute: An attribute of an entity is called an attribute.\u003c/li\u003e\n\u003cli\u003eKey: The set of attributes that uniquely identify an entity is called a key.\u003c/li\u003e\n\u003cli\u003eEntity type: Use entity name and its attribute name set to abstract and characterize similar entities, called entity type.\u003c/li\u003e\n\u003cli\u003eEntity set: A set of the same entity type is called an entity set.\u003c/li\u003e\n\u003cli\u003eRelationship: The relationship between entities usually refers to the connection between different sets of entities.\u003c/li\u003e\n\u003cli\u003eSchema: A schema is also called a logical schema. It is a description of the logical structure and characteristics of the entire database data. It is a common data view for all users.\u003c/li\u003e\n\u003cli\u003eExternal schema: External schema is also called subschema or user schema. It is a description of the logical structure and characteristics of local data that database users (including application programmers and end users) can see and use. A database user's data view is a logical representation of data related to an application.\u003c/li\u003e\n\u003cli\u003eInternal schema: Internal schema is also called storage schema. A database has only one internal schema. It is a description of the physical structure and storage of the data, and the way the database is organized within the database.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCommon data models\u003c/h3\u003e\u003ca id=\"user-content-common-data-models\" class=\"anchor\" aria-label=\"Permalink: Common data models\" href=\"#common-data-models\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eHierarchical model\u003c/li\u003e\n\u003cli\u003eNetwork model\u003c/li\u003e\n\u003cli\u003eRelational model\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eRelation (relation): a relation corresponds to a table\u003c/li\u003e\n\u003cli\u003eTuple: a row in the table is a tuple\u003c/li\u003e\n\u003cli\u003eAttribute (attribute): a column in the table is an attribute\u003c/li\u003e\n\u003cli\u003eKey: A certain attribute group of a tuple can be uniquely identified in the table\u003c/li\u003e\n\u003cli\u003eDomain (domain): a set of values of the same data type\u003c/li\u003e\n\u003cli\u003eComponent: an attribute value in a tuple\u003c/li\u003e\n\u003cli\u003eRelation mode: description of the relationship, generally expressed as \u003ccode\u003erelation name (attribute 1, attribute 2, ..., attribute n)\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eObject oriented data model\u003c/li\u003e\n\u003cli\u003eObject relational data model\u003c/li\u003e\n\u003cli\u003eSemistructured data model\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCommon SQL Operations\u003c/h3\u003e\u003ca id=\"user-content-common-sql-operations\" class=\"anchor\" aria-label=\"Permalink: Common SQL Operations\" href=\"#common-sql-operations\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n \u003ctbody\u003e\u003ctr\u003e\n \u003cth\u003e Object type \n \u003c/th\u003e\u003cth\u003e Object \n \u003c/th\u003e\u003cth\u003e Type of operation \n \n \u003c/th\u003e\u003c/tr\u003e\u003ctr\u003e\n \u003ctd rowspan=\"4\"\u003e Database mode \n \u003c/td\u003e\u003ctd\u003e Mode \n \u003c/td\u003e\u003ctd\u003e \u003ccode\u003e CREATE SCHEMA \n \n \u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e Basic table \n \u003c/td\u003e\u003ctd\u003e \u003ccode\u003e CREATE SCHEMA , \u003ccode\u003e ALTER TABLE \n \n \u003c/code\u003e\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e View \n \u003c/td\u003e\u003ctd\u003e \u003ccode\u003e CREATE VIEW \n \n \u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e Index \n \u003c/td\u003e\u003ctd\u003e \u003ccode\u003e CREATE INDEX \n \n \u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\n \u003ctd rowspan=\"2\"\u003e Data \n \u003c/td\u003e\u003ctd\u003e Basic tables and views \n \u003c/td\u003e\u003ctd\u003e \u003ccode\u003e SELECT , \u003ccode\u003e INSERT , \u003ccode\u003e UPDATE , \u003ccode\u003e DELETE , \u003ccode\u003e REFERENCES , \u003ccode\u003e ALL PRIVILEGES \n \n \u003c/code\u003e\u003c/code\u003e\u003c/code\u003e\u003c/code\u003e\u003c/code\u003e\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\n \u003ctd\u003e Attribute column \n \u003c/td\u003e\u003ctd\u003e \u003ccode\u003e SELECT , \u003ccode\u003e INSERT , \u003ccode\u003e UPDATE , \u003ccode\u003e REFERENCES , \u003ccode\u003e ALL PRIVILEGES \n \n\u003c/code\u003e\u003c/code\u003e\u003c/code\u003e\u003c/code\u003e\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eSQL Grammar Tutorial: \u003ca href=\"http://www.runoob.com/sql/sql-tutorial.html\" rel=\"nofollow\"\u003erunoob . SQL Tutorial\u003c/a\u003e\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRelational Database\u003c/h3\u003e\u003ca id=\"user-content-relational-database\" class=\"anchor\" aria-label=\"Permalink: Relational Database\" href=\"#relational-database\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBasic relation operations: query (selection, projection, connection (equivalent connection, natural connection, outer connection (left outer connection, right outer connection)), division, union, difference, intersection, Cartesian product, etc.), insertion, deletion ,modify\u003c/li\u003e\n\u003cli\u003eThree types of integrity constraints in the relationship model: entity integrity, referential integrity, user-defined integrity\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eIndex\u003c/h4\u003e\u003ca id=\"user-content-index\" class=\"anchor\" aria-label=\"Permalink: Index\" href=\"#index\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eDatabase index: sequential index, B + tree index, hash index\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://blog.codinglabs.org/articles/theory-of-mysql-index.html\" rel=\"nofollow\"\u003eData structure and algorithm principle behind MySQL index\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDatabase integrity\u003c/h3\u003e\u003ca id=\"user-content-database-integrity\" class=\"anchor\" aria-label=\"Permalink: Database integrity\" href=\"#database-integrity\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eDatabase integrity refers to the correctness and compatibility of data.\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eIntegrity: To prevent non-semantic (incorrect) data from the database.\u003c/li\u003e\n\u003cli\u003eSecurity: In order to protect the database from malicious damage and illegal access.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eTrigger: is a special event-driven process defined by the user in the relational table.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRelational data theory\u003c/h3\u003e\u003ca id=\"user-content-relational-data-theory\" class=\"anchor\" aria-label=\"Permalink: Relational data theory\" href=\"#relational-data-theory\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eData dependency is a constraint relationship between the internal attributes and attributes of a relationship. It is a correlation between data that is reflected by the equality of the values between attributes.\u003c/li\u003e\n\u003cli\u003eThe most important data dependencies: function dependencies, multi-value dependencies.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eParadigm\u003c/h4\u003e\u003ca id=\"user-content-paradigm\" class=\"anchor\" aria-label=\"Permalink: Paradigm\" href=\"#paradigm\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFirst Normal Form (1NF): The attribute (field) is the smallest unit and cannot be separated.\u003c/li\u003e\n\u003cli\u003eThe second normal form (2NF): meet 1NF, each non-primary attribute completely depends on the primary key (eliminating the partial function dependence of 1NF non-primary attribute on the code).\u003c/li\u003e\n\u003cli\u003eThe third normal form (3NF): 2NF is satisfied, and any non-primary attribute does not depend on other non-primary attributes (eliminating the 2NF non-primary attribute's transfer function dependence on the code).\u003c/li\u003e\n\u003cli\u003eBowies-Kode Normal Form (BCNF): Satisfy 3NF, any non-primary attribute cannot depend on the subset of primary keys (eliminating the 3NF primary attribute's dependence on the code part and transfer function)\u003c/li\u003e\n\u003cli\u003eThe fourth normal form (4NF): meet 3NF, there must be non-trivial and non-functional dependent multi-value dependencies between attributes (eliminating 3NF non-trivial and non-functional multi-value dependencies).\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDatabase Recovery\u003c/h3\u003e\u003ca id=\"user-content-database-recovery\" class=\"anchor\" aria-label=\"Permalink: Database Recovery\" href=\"#database-recovery\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eTransaction: It is a user-defined sequence of database operations. These operations are either all done or not done at all. It is an indivisible unit of work.\u003c/li\u003e\n\u003cli\u003eACID characteristics of things: atomicity, consistency, isolation, persistence.\u003c/li\u003e\n\u003cli\u003eImplementation technology of recovery: establish redundant data-\u0026gt; use redundant data to implement database recovery.\u003c/li\u003e\n\u003cli\u003eCommon techniques for establishing redundant data: data dumps (dynamic mass dumps, dynamic incremental dumps, static mass dumps, static incremental dumps), registration log files.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eConcurrency control\u003c/h3\u003e\u003ca id=\"user-content-concurrency-control\" class=\"anchor\" aria-label=\"Permalink: Concurrency control\" href=\"#concurrency-control\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eTransactions are the basic unit of concurrency control.\u003c/li\u003e\n\u003cli\u003eData inconsistencies caused by concurrent operations include: lost modifications, non-repeatable reads, and \"dirty\" data reads.\u003c/li\u003e\n\u003cli\u003eThe main technologies of concurrency control: blocking, timestamp, optimistic control method, multi-version concurrency control, etc.\u003c/li\u003e\n\u003cli\u003eBasic lock types: exclusive lock (X lock / write lock), shared lock (S lock / read lock).\u003c/li\u003e\n\u003cli\u003eLivelock deadlock:\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eLivelock: The transaction is always in a waiting state, which can be avoided through a first come, first served policy.\u003c/li\u003e\n\u003cli\u003eDeadlock: The transaction can never end\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ePrevention: one-time block method, sequential block method;\u003c/li\u003e\n\u003cli\u003eDiagnosis: timeout method, waiting graph method;\u003c/li\u003e\n\u003cli\u003eCancel: Undo the transaction with the least deadlock cost and release all the locks of this transaction, so that other transactions can continue to run.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eSerializable scheduling: The concurrent execution of multiple transactions is correct if and only if the result is the same as when the transactions are executed serially in a certain order. Guidelines for correct scheduling of concurrent transactions when serializable.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-design-pattern\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e📏 Design pattern\u003c/h2\u003e\u003ca id=\"user-content--design-pattern\" class=\"anchor\" aria-label=\"Permalink: 📏 Design pattern\" href=\"#-design-pattern\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eExamples of major design patterns: \u003ca href=\"https://blog.csdn.net/liang19890820/article/details/66974516\" rel=\"nofollow\"\u003eCSDN column. C ++ Design Patterns\u003c/a\u003e series of blog posts\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DesignPattern\"\u003eDesign Pattern Project Catalog\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSingleton mode\u003c/h3\u003e\u003ca id=\"user-content-singleton-mode\" class=\"anchor\" aria-label=\"Permalink: Singleton mode\" href=\"#singleton-mode\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DesignPattern/SingletonPattern\"\u003eSingleton Pattern Example\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAbstract factory pattern\u003c/h3\u003e\u003ca id=\"user-content-abstract-factory-pattern\" class=\"anchor\" aria-label=\"Permalink: Abstract factory pattern\" href=\"#abstract-factory-pattern\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DesignPattern/AbstractFactoryPattern\"\u003eAbstract Factory Pattern Example\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAdapter Mode\u003c/h3\u003e\u003ca id=\"user-content-adapter-mode\" class=\"anchor\" aria-label=\"Permalink: Adapter Mode\" href=\"#adapter-mode\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DesignPattern/AdapterPattern\"\u003eAdapter pattern example\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBridge mode\u003c/h3\u003e\u003ca id=\"user-content-bridge-mode\" class=\"anchor\" aria-label=\"Permalink: Bridge mode\" href=\"#bridge-mode\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DesignPattern/BridgePattern\"\u003eBridge pattern example\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eObserver mode\u003c/h3\u003e\u003ca id=\"user-content-observer-mode\" class=\"anchor\" aria-label=\"Permalink: Observer mode\" href=\"#observer-mode\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"/huihut/interview/blob/master/DesignPattern/ObserverPattern\"\u003eExample of Observer Pattern\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSix Principles of Design Patterns\u003c/h3\u003e\u003ca id=\"user-content-six-principles-of-design-patterns\" class=\"anchor\" aria-label=\"Permalink: Six Principles of Design Patterns\" href=\"#six-principles-of-design-patterns\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSingle Responsibility Principle (SRP)\u003c/li\u003e\n\u003cli\u003eLiskov Substitution Principle (LSP)\u003c/li\u003e\n\u003cli\u003eDependence Inversion Principle (DIP)\u003c/li\u003e\n\u003cli\u003eInterface Segregation Principle (ISP)\u003c/li\u003e\n\u003cli\u003eLaw of Demeter (LoD)\u003c/li\u003e\n\u003cli\u003eOpen Close Principle (OCP)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-link-loading-library\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e⚙️ Link Loading Library\u003c/h2\u003e\u003ca id=\"user-content-️-link-loading-library\" class=\"anchor\" aria-label=\"Permalink: ⚙️ Link Loading Library\" href=\"#️-link-loading-library\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003ePart of the knowledge in this section comes from \"Programmer's Self-Cultivation-Link Loading Library\"\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003ememory, stack, heap\u003c/h3\u003e\u003ca id=\"user-content-memory-stack-heap\" class=\"anchor\" aria-label=\"Permalink: memory, stack, heap\" href=\"#memory-stack-heap\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe general application memory space has the following areas:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eStack: Automatically allocated and released by the operating system, storing function parameter values, local variable values, etc., used to maintain the context of function calls\u003c/li\u003e\n\u003cli\u003eHeap: Generally allocated and released by the programmer. If the programmer does not release, it may be recycled by the operating system at the end of the program to accommodate the dynamically allocated memory area of the application.\u003c/li\u003e\n\u003cli\u003eExecutable image: Stores the image of the executable file in memory. Loading by the loader is to read or map the memory of the executable file here.\u003c/li\u003e\n\u003cli\u003eReserved area: The reserved area is not a single memory area, but a general term for memory areas that are protected from access in the memory. For example, in C, the invalid pointer is assigned a value of 0 (NULL), so the 0 address is normal. Impossible to access data efficiently\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003estack\u003c/h4\u003e\u003ca id=\"user-content-stack\" class=\"anchor\" aria-label=\"Permalink: stack\" href=\"#stack\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe stack stores the maintenance information required for a function call. It is often called a stack frame or an active record. It generally contains the following aspects:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFunction return address and parameters\u003c/li\u003e\n\u003cli\u003eTemporary variables: including non-static local variables of functions and other temporary variables automatically generated by the compiler\u003c/li\u003e\n\u003cli\u003eSave context: including registers that need to remain unchanged before and after function calls\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eHeap\u003c/h4\u003e\u003ca id=\"user-content-heap\" class=\"anchor\" aria-label=\"Permalink: Heap\" href=\"#heap\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eHeap allocation algorithm:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eFree List\u003c/li\u003e\n\u003cli\u003eBitmap\u003c/li\u003e\n\u003cli\u003eObject pool\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e\"Segment fault\" or \"Illegal operation, this memory address cannot be read / write\"\u003c/h4\u003e\u003ca id=\"user-content-segment-fault-or-illegal-operation-this-memory-address-cannot-be-read--write\" class=\"anchor\" aria-label=\"Permalink: \u0026quot;Segment fault\u0026quot; or \u0026quot;Illegal operation, this memory address cannot be read / write\u0026quot;\" href=\"#segment-fault-or-illegal-operation-this-memory-address-cannot-be-read--write\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eErrors caused by typical illegal pointer dereferencing. This error occurs when the pointer points to a memory address that is not allowed to read and write, and the program attempts to use the pointer to read or write that address.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCommon reasons:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eInitialize the pointer to NULL, then start using the pointer without giving it a reasonable value\u003c/li\u003e\n\u003cli\u003eThere is no need to initialize the pointer in the stack. The value of the pointer will generally be a random number. After that, the pointer is used directly.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCompile and link\u003c/h3\u003e\u003ca id=\"user-content-compile-and-link\" class=\"anchor\" aria-label=\"Permalink: Compile and link\" href=\"#compile-and-link\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFile formats for each platform\u003c/h4\u003e\u003ca id=\"user-content-file-formats-for-each-platform\" class=\"anchor\" aria-label=\"Permalink: File formats for each platform\" href=\"#file-formats-for-each-platform\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003ePlatform\u003c/th\u003e\n\u003cth\u003eExecutables\u003c/th\u003e\n\u003cth\u003eObjects\u003c/th\u003e\n\u003cth\u003eDynamic Libraries / Shared Objects\u003c/th\u003e\n\u003cth\u003eStatic Libraries\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eWindows\u003c/td\u003e\n\u003ctd\u003eexe\u003c/td\u003e\n\u003ctd\u003eobj\u003c/td\u003e\n\u003ctd\u003edll\u003c/td\u003e\n\u003ctd\u003elib\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eUnix/Linux\u003c/td\u003e\n\u003ctd\u003eELF、out\u003c/td\u003e\n\u003ctd\u003eo\u003c/td\u003e\n\u003ctd\u003eso\u003c/td\u003e\n\u003ctd\u003ea\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eMac\u003c/td\u003e\n\u003ctd\u003eMach-O\u003c/td\u003e\n\u003ctd\u003eo\u003c/td\u003e\n\u003ctd\u003edylib、tbd、framework\u003c/td\u003e\n\u003ctd\u003ea、framework\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCompile and link process\u003c/h4\u003e\u003ca id=\"user-content-compile-and-link-process\" class=\"anchor\" aria-label=\"Permalink: Compile and link process\" href=\"#compile-and-link-process\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003ePre-compilation (pre-compiler processes pre-compilation instructions such as \u003ccode\u003e# include\u003c/code\u003e,\u003ccode\u003e # define\u003c/code\u003e and generates \u003ccode\u003e.i\u003c/code\u003e or\u003ccode\u003e .ii\u003c/code\u003e files)\u003c/li\u003e\n\u003cli\u003eCompile (the compiler performs lexical analysis, syntax analysis, semantic analysis, intermediate code generation, object code generation, optimization, and generation of \u003ccode\u003e.s\u003c/code\u003e files)\u003c/li\u003e\n\u003cli\u003eAssembly (the assembler translates the assembly code into machine code and generates a \u003ccode\u003e.o\u003c/code\u003e file)\u003c/li\u003e\n\u003cli\u003eLinking (connectors perform address and space allocation, symbol resolution, relocation, and generate \u003ccode\u003e.out\u003c/code\u003e files)\u003c/li\u003e\n\u003c/ol\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eThe current version of GCC combines pre-compilation and compilation into one step, pre-compiled compiler cc1, assembler as, linker ld\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eMSVC compilation environment, compiler cl, linker link, executable file viewer dumpbin\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003etarget document\u003c/h4\u003e\u003ca id=\"user-content-target-document\" class=\"anchor\" aria-label=\"Permalink: target document\" href=\"#target-document\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe files generated by the compiler after compiling the source code are called object files. The object file is structurally speaking, it is a compiled executable file format, but the linking process has not yet been performed, and some symbols or addresses may not be adjusted.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eExecutable files (\u003ccode\u003e.exe\u003c/code\u003e for Windows and\u003ccode\u003e ELF\u003c/code\u003e for Linux), dynamic link libraries (\u003ccode\u003e.dll\u003c/code\u003e for Windows and\u003ccode\u003e .so\u003c/code\u003e for Linux), static link libraries (\u003ccode\u003e.lib\u003c/code\u003e for Windows and Linux \u003ccode\u003e.A\u003c/code\u003e) are stored according to the executable file format (Windows according to PE-COFF, Linux according to ELF)\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eObject file format\u003c/h5\u003e\u003ca id=\"user-content-object-file-format\" class=\"anchor\" aria-label=\"Permalink: Object file format\" href=\"#object-file-format\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eWindows PE (Portable Executable), or PE-COFF, \u003ccode\u003e.obj\u003c/code\u003e format\u003c/li\u003e\n\u003cli\u003eLinux's ELF (Executable Linkable Format), \u003ccode\u003e.o\u003c/code\u003e format\u003c/li\u003e\n\u003cli\u003eIntel / Microsoft OMF (Object Module Format)\u003c/li\u003e\n\u003cli\u003eUnix \u003ccode\u003ea.out\u003c/code\u003e format\u003c/li\u003e\n\u003cli\u003eMS-DOS \u003ccode\u003e.COM\u003c/code\u003e format\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003ePE and ELF are both COFF (Common File Format) variants\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eObject file storage structure\u003c/h5\u003e\u003ca id=\"user-content-object-file-storage-structure\" class=\"anchor\" aria-label=\"Permalink: Object file storage structure\" href=\"#object-file-storage-structure\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSegment\u003c/th\u003e\n\u003cth\u003eFunction\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eFile Header\u003c/td\u003e\n\u003ctd\u003eFile header, describing the file attributes of the entire file (including whether the file is executable, is it statically linked or dynamically linked with the entry address, target hardware, target operating system, etc.)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e.text section\u003c/td\u003e\n\u003ctd\u003eCode section, machine code compiled by the execution statement\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e.data section\u003c/td\u003e\n\u003ctd\u003eData section, initialized global and local static variables\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e.bss section\u003c/td\u003e\n\u003ctd\u003eBSS section (Block Started by Symbol), uninitialized global and local static variables (because the default value is 0, so it is only reserved here and does not take up space)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e.rodata section\u003c/td\u003e\n\u003ctd\u003eRead-only data section, which stores read-only data, generally read-only variables (such as const-modified variables) and string constants in the program\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e.comment section\u003c/td\u003e\n\u003ctd\u003eComment section for compiler version information\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e.note.GNU-stack section\u003c/td\u003e\n\u003ctd\u003eStack hint section\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eOther paragraphs omitted\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLinked Interface-Symbol\u003c/h4\u003e\u003ca id=\"user-content-linked-interface-symbol\" class=\"anchor\" aria-label=\"Permalink: Linked Interface-Symbol\" href=\"#linked-interface-symbol\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIn the link, the object files are actually a reference to the address between the object files, that is, a reference to the address of a function and a variable. We collectively refer to functions and variables as Symbols, and function names or variable names are Symbol Names.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe following Symbol Table:\u003c/p\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSymbol (Symbol Name)\u003c/th\u003e\n\u003cth\u003eSymbol Value (Address)\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003emain\u003c/td\u003e\n\u003ctd\u003e0x100\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAdd\u003c/td\u003e\n\u003ctd\u003e0x123\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e...\u003c/td\u003e\n\u003ctd\u003e...\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eShared Library for Linux\u003c/h3\u003e\u003ca id=\"user-content-shared-library-for-linux\" class=\"anchor\" aria-label=\"Permalink: Shared Library for Linux\" href=\"#shared-library-for-linux\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eShared libraries under Linux are ordinary ELF shared objects.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe shared library version update should ensure the compatibility of the binary interface ABI (Application Binary Interface)\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eName\u003c/h4\u003e\u003ca id=\"user-content-name\" class=\"anchor\" aria-label=\"Permalink: Name\" href=\"#name\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003elibname.so.x.y.z\u003c/code\u003e\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003ex: major version number, libraries with different major version numbers are not compatible and need to be recompiled\u003c/li\u003e\n\u003cli\u003ey: minor version number, higher version number is backward compatible with lower version number\u003c/li\u003e\n\u003cli\u003ez: release version number, no interface changes, fully compatible\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003epath\u003c/h4\u003e\u003ca id=\"user-content-path\" class=\"anchor\" aria-label=\"Permalink: path\" href=\"#path\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eMost open source systems, including Linux, follow the FHS (File Hierarchy Standard) standard. This standard specifies how system files are stored, including various directory structures, organizations, and roles.\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003e/lib\u003c/code\u003e: Stores the most critical and basic shared libraries of the system, such as dynamic linker, C language runtime library, math library, etc.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/usr/lib\u003c/code\u003e: Stores key libraries required by non-system runtime, mainly development libraries\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e/usr/local/lib\u003c/code\u003e: Stores libraries that are not very relevant to the operating system itself, mainly libraries for some third-party applications\u003c/li\u003e\n\u003c/ul\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eThe dynamic linker looks for shared libraries in \u003ccode\u003e/ lib\u003c/code\u003e, \u003ccode\u003e/usr/lib\u003c/code\u003e, and specified by the \u003ccode\u003e/etc/ld.so.conf\u003c/code\u003e configuration file\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eEnvironment variables\u003c/h4\u003e\u003ca id=\"user-content-environment-variables\" class=\"anchor\" aria-label=\"Permalink: Environment variables\" href=\"#environment-variables\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003eLD_LIBRARY_PATH\u003c/code\u003e: temporarily change the shared library search path of an application without affecting other applications\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eLD_PRELOAD\u003c/code\u003e: specify some shared libraries or even object files that are pre-loaded\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003eLD_DEBUG\u003c/code\u003e: Turn on the debugging function of the dynamic linker\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSo shared library writing\u003c/h4\u003e\u003ca id=\"user-content-so-shared-library-writing\" class=\"anchor\" aria-label=\"Permalink: So shared library writing\" href=\"#so-shared-library-writing\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWriting shared libraries with CLion\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCreate a shared library named MySharedLib\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCMakeLists.txt\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-cmake notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"cmake_minimum_required(VERSION 3.10)\nproject(MySharedLib)\n\nset(CMAKE_CXX_STANDARD 11)\n\nadd_library(MySharedLib SHARED library.cpp library.h)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003ecmake_minimum_required\u003c/span\u003e(\u003cspan class=\"pl-e\"\u003eVERSION\u003c/span\u003e 3.10)\n\u003cspan class=\"pl-k\"\u003eproject\u003c/span\u003e(MySharedLib)\n\n\u003cspan class=\"pl-k\"\u003eset\u003c/span\u003e(CMAKE_CXX_STANDARD 11)\n\n\u003cspan class=\"pl-k\"\u003eadd_library\u003c/span\u003e(MySharedLib SHARED library.cpp library.h)\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003elibrary.h\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#ifndef MYSHAREDLIB_LIBRARY_H\n#define MYSHAREDLIB_LIBRARY_H\n\n// print Hello World!\nvoid hello();\n\n// Sum using variable template parameters\ntemplate \u0026lt;typename T\u0026gt;\nT sum(T t)\n{\n return t;\n}\ntemplate \u0026lt;typename T, typename ...Types\u0026gt;\nT sum(T first, Types ... rest)\n{\n return first + sum\u0026lt;T\u0026gt;(rest...);\n}\n\n#endif\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003eifndef\u003c/span\u003e MYSHAREDLIB_LIBRARY_H\n#\u003cspan class=\"pl-k\"\u003edefine\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eMYSHAREDLIB_LIBRARY_H\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e print Hello World!\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ehello\u003c/span\u003e();\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Sum using variable template parameters\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etemplate \u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003etypename\u003c/span\u003e T\u0026gt;\nT \u003cspan class=\"pl-en\"\u003esum\u003c/span\u003e(T t)\n{\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e t;\n}\n\u003cspan class=\"pl-k\"\u003etemplate \u003c/span\u003e\u0026lt;\u003cspan class=\"pl-k\"\u003etypename\u003c/span\u003e T, \u003cspan class=\"pl-k\"\u003etypename\u003c/span\u003e ...Types\u0026gt;\nT \u003cspan class=\"pl-en\"\u003esum\u003c/span\u003e(T first, Types ... rest)\n{\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e first + sum\u0026lt;T\u0026gt;(rest...);\n}\n\n#\u003cspan class=\"pl-k\"\u003eendif\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003elibrary.cpp\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#include \u0026lt;iostream\u0026gt;\n#include \u0026quot;library.h\u0026quot;\n\nvoid hello() {\n std::cout \u0026lt;\u0026lt; \u0026quot;Hello, World!\u0026quot; \u0026lt;\u0026lt; std::endl;\n}\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eiostream\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003elibrary.h\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\n\n\u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e \u003cspan class=\"pl-en\"\u003ehello\u003c/span\u003e() {\n std::cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eHello, World!\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; std::endl;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003euse of so shared library (called by executable project)\u003c/h4\u003e\u003ca id=\"user-content-use-of-so-shared-library-called-by-executable-project\" class=\"anchor\" aria-label=\"Permalink: use of so shared library (called by executable project)\" href=\"#use-of-so-shared-library-called-by-executable-project\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eUse CLion to call a shared library\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCreate an executable project named TestSharedLib\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eCMakeLists.txt\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-cmake notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"cmake_minimum_required (VERSION 3.10)\nproject (TestSharedLib)\n\n# C ++ 11 compile\nset (CMAKE_CXX_STANDARD 11)\n\n# Header file path\nset (INC_DIR / home / xx / code / clion / MySharedLib)\n# Library file path\nset (LIB_DIR / home / xx / code / clion / MySharedLib / cmake-build-debug)\n\ninclude_directories(${INC_DIR})\nlink_directories(${LIB_DIR})\nlink_libraries(MySharedLib)\n\nadd_executable(TestSharedLib main.cpp)\n\n# link MySharedLib Library\ntarget_link_libraries(TestSharedLib MySharedLib)\"\u003e\u003cpre\u003e\u003cspan class=\"pl-k\"\u003ecmake_minimum_required\u003c/span\u003e (\u003cspan class=\"pl-e\"\u003eVERSION\u003c/span\u003e 3.10)\n\u003cspan class=\"pl-k\"\u003eproject\u003c/span\u003e (TestSharedLib)\n\n\u003cspan class=\"pl-c\"\u003e# C ++ 11 compile\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eset\u003c/span\u003e (CMAKE_CXX_STANDARD 11)\n\n\u003cspan class=\"pl-c\"\u003e# Header file path\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eset\u003c/span\u003e (INC_DIR / home / xx / code / clion / MySharedLib)\n\u003cspan class=\"pl-c\"\u003e# Library file path\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eset\u003c/span\u003e (LIB_DIR / home / xx / code / clion / MySharedLib / cmake-\u003cspan class=\"pl-e\"\u003ebuild\u003c/span\u003e-debug)\n\n\u003cspan class=\"pl-k\"\u003einclude_directories\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e${INC_DIR}\u003c/span\u003e)\n\u003cspan class=\"pl-k\"\u003elink_directories\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003e${LIB_DIR}\u003c/span\u003e)\n\u003cspan class=\"pl-k\"\u003elink_libraries\u003c/span\u003e(MySharedLib)\n\n\u003cspan class=\"pl-k\"\u003eadd_executable\u003c/span\u003e(TestSharedLib main.cpp)\n\n\u003cspan class=\"pl-c\"\u003e# link MySharedLib Library\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003etarget_link_libraries\u003c/span\u003e(TestSharedLib MySharedLib)\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003emain.cpp\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"#include \u0026lt;iostream\u0026gt;\n#include \u0026quot;library.h\u0026quot;\nusing std::cout;\nusing std::endl;\n\nint main() {\n\n hello();\n cout \u0026lt;\u0026lt; \u0026quot;1 + 2 = \u0026quot; \u0026lt;\u0026lt; sum(1,2) \u0026lt;\u0026lt; endl;\n cout \u0026lt;\u0026lt; \u0026quot;1 + 2 + 3 = \u0026quot; \u0026lt;\u0026lt; sum(1,2,3) \u0026lt;\u0026lt; endl;\n\n return 0;\n}\"\u003e\u003cpre\u003e#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003eiostream\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003elibrary.h\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e std::cout;\n\u003cspan class=\"pl-k\"\u003eusing\u003c/span\u003e std::endl;\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e() {\n\n \u003cspan class=\"pl-c1\"\u003ehello\u003c/span\u003e();\n cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e1 + 2 = \u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; \u003cspan class=\"pl-c1\"\u003esum\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e,\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e) \u0026lt;\u0026lt; endl;\n cout \u0026lt;\u0026lt; \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e1 + 2 + 3 = \u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e \u0026lt;\u0026lt; \u003cspan class=\"pl-c1\"\u003esum\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e,\u003cspan class=\"pl-c1\"\u003e2\u003c/span\u003e,\u003cspan class=\"pl-c1\"\u003e3\u003c/span\u003e) \u0026lt;\u0026lt; endl;\n\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eResults\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"Hello, World!\n1 + 2 = 3\n1 + 2 + 3 = 6\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eHello, World!\n1 + 2 = 3\n1 + 2 + 3 = 6\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWindows Application entry function\u003c/h3\u003e\u003ca id=\"user-content-windows-application-entry-function\" class=\"anchor\" aria-label=\"Permalink: Windows Application entry function\" href=\"#windows-application-entry-function\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eGUI(Graphical User Interface) application, linker options:\u003ccode\u003e/SUBSYSTEM:WINDOWS\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eCUI(Console User Interface) application, linker options:\u003ccode\u003e/SUBSYSTEM:CONSOLE\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e_tWinMain versus _tmain Function declaration\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"Int WINAPI _tWinMain(\n HINSTANCE hInstanceExe,\n HINSTANCE,\n PTSTR pszCmdLine,\n int nCmdShow);\n\nint _tmain(\n int argc,\n TCHAR *argv[],\n TCHAR *envp[]);\"\u003e\u003cpre\u003eInt WINAPI \u003cspan class=\"pl-en\"\u003e_tWinMain\u003c/span\u003e(\n HINSTANCE hInstanceExe,\n HINSTANCE,\n PTSTR pszCmdLine,\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e nCmdShow);\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003e_tmain\u003c/span\u003e(\n \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e argc,\n TCHAR *argv[],\n TCHAR *envp[]);\u003c/pre\u003e\u003c/div\u003e\n\u003cmarkdown-accessiblity-table\u003e\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eApplication Type\u003c/th\u003e\n\u003cth\u003eEntry Point Function\u003c/th\u003e\n\u003cth\u003eEmbedded Startup Function\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003eGUI application for processing ANSI characters (strings)\u003c/td\u003e\n\u003ctd\u003e_tWinMain (WinMain)\u003c/td\u003e\n\u003ctd\u003eWinMainCRTSartup\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eGUI application for handling Unicode characters (strings)\u003c/td\u003e\n\u003ctd\u003e_tWinMain (wWinMain)\u003c/td\u003e\n\u003ctd\u003ewWinMainCRTSartup\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCUI application that handles ANSI characters (strings)\u003c/td\u003e\n\u003ctd\u003e_tmain (Main)\u003c/td\u003e\n\u003ctd\u003emainCRTSartup\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCUI application for handling Unicode characters (strings)\u003c/td\u003e\n\u003ctd\u003e_tmain (wMain)\u003c/td\u003e\n\u003ctd\u003ewmainCRTSartup\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eDynamic-Link Library\u003c/td\u003e\n\u003ctd\u003eDllMain\u003c/td\u003e\n\u003ctd\u003e_DllMainCRTStartup\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\u003c/markdown-accessiblity-table\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDynamic-Link Library for Windows\u003c/h3\u003e\u003ca id=\"user-content-dynamic-link-library-for-windows\" class=\"anchor\" aria-label=\"Permalink: Dynamic-Link Library for Windows\" href=\"#dynamic-link-library-for-windows\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003ePart of the knowledge comes from \"Windows Core Programming (Fifth Edition)\"\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUses\u003c/h4\u003e\u003ca id=\"user-content-uses\" class=\"anchor\" aria-label=\"Permalink: Uses\" href=\"#uses\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eExpanded application features\u003c/li\u003e\n\u003cli\u003eSimplified project management\u003c/li\u003e\n\u003cli\u003eHelps save memory\u003c/li\u003e\n\u003cli\u003ePromote the sharing of resources\u003c/li\u003e\n\u003cli\u003eImproved localization\u003c/li\u003e\n\u003cli\u003eHelps resolve differences between platforms\u003c/li\u003e\n\u003cli\u003eCan be used for special purposes\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eNote\u003c/h4\u003e\u003ca id=\"user-content-note\" class=\"anchor\" aria-label=\"Permalink: Note\" href=\"#note\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eCreating a DLL is actually creating a function that can be called by an executable module\u003c/li\u003e\n\u003cli\u003eWhen a module provides a memory allocation function (malloc, new), it must also provide another memory release function (free, delete)\u003c/li\u003e\n\u003cli\u003eWhen mixing C and C++, use the extern \"C\" modifier\u003c/li\u003e\n\u003cli\u003eA DLL can export functions, variables (to avoid export), C++ classes (export and import need to be the same as the compiler, otherwise avoid export)\u003c/li\u003e\n\u003cli\u003eDLL module: __declspec (dllexport) in the cpp file is written before the include header file\u003c/li\u003e\n\u003cli\u003eCalling DLL's executable module: __declspec (dllimport) of the cpp file should not define MYLIBAPI before\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSearch order for loading Windows programs\u003c/h4\u003e\u003ca id=\"user-content-search-order-for-loading-windows-programs\" class=\"anchor\" aria-label=\"Permalink: Search order for loading Windows programs\" href=\"#search-order-for-loading-windows-programs\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eDirectory containing executable files\u003c/li\u003e\n\u003cli\u003eThe system directory of Windows can be obtained through GetSystemDirectory\u003c/li\u003e\n\u003cli\u003e16-bit system directory, the System subdirectory in the Windows directory\u003c/li\u003e\n\u003cli\u003eThe Windows directory can be obtained through GetWindowsDirectory\u003c/li\u003e\n\u003cli\u003eThe current directory of the process\u003c/li\u003e\n\u003cli\u003eDirectories listed in the PATH environment variable\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDLL Entry function\u003c/h4\u003e\u003ca id=\"user-content-dll-entry-function\" class=\"anchor\" aria-label=\"Permalink: DLL Entry function\" href=\"#dll-entry-function\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eDllMain function\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)\n{\n switch(fdwReason)\n {\n case DLL_PROCESS_ATTACH:\n // Called when mapping a DLL to the process address space for the first time\n // The DLL is being mapped into the process' address space.\n break;\n case DLL_THREAD_ATTACH:\n // When the process creates a thread, it is used to tell the DLL to perform thread-related initialization (non-main thread execution)\n // A thread is bing created.\n break;\n case DLL_THREAD_DETACH:\n // The system calls ExitThread before the thread exits, the thread that is about to be terminated performs thread-related cleanup by telling the DLL\n // A thread is exiting cleanly.\n break;\n case DLL_PROCESS_DETACH:\n // Called when a DLL is removed from the process's address space\n // The DLL is being unmapped from the process' address space.\n break;\n }\n \n return (TRUE); // Used only for DLL_PROCESS_ATTACH\n}\"\u003e\u003cpre\u003eBOOL WINAPI \u003cspan class=\"pl-en\"\u003eDllMain\u003c/span\u003e(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)\n{\n \u003cspan class=\"pl-k\"\u003eswitch\u003c/span\u003e(fdwReason)\n {\n \u003cspan class=\"pl-k\"\u003ecase\u003c/span\u003e DLL_PROCESS_ATTACH:\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Called when mapping a DLL to the process address space for the first time\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e The DLL is being mapped into the process' address space.\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003ebreak\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003ecase\u003c/span\u003e DLL_THREAD_ATTACH:\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e When the process creates a thread, it is used to tell the DLL to perform thread-related initialization (non-main thread execution)\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e A thread is bing created.\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003ebreak\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003ecase\u003c/span\u003e DLL_THREAD_DETACH:\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e The system calls ExitThread before the thread exits, the thread that is about to be terminated performs thread-related cleanup by telling the DLL\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e A thread is exiting cleanly.\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003ebreak\u003c/span\u003e;\n \u003cspan class=\"pl-k\"\u003ecase\u003c/span\u003e DLL_PROCESS_DETACH:\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Called when a DLL is removed from the process's address space\u003c/span\u003e\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e The DLL is being unmapped from the process' address space.\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003ebreak\u003c/span\u003e;\n }\n \n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e (\u003cspan class=\"pl-c1\"\u003eTRUE\u003c/span\u003e); \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Used only for DLL_PROCESS_ATTACH\u003c/span\u003e\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLoad and unload library\u003c/h4\u003e\u003ca id=\"user-content-load-and-unload-library\" class=\"anchor\" aria-label=\"Permalink: Load and unload library\" href=\"#load-and-unload-library\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eLoadLibrary、LoadLibraryExA、LoadPackagedLibrary、FreeLibrary、FreeLibraryAndExitThread Function declaration\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// load library\nHMODULE WINAPI LoadLibrary (\n _In_ LPCTSTR lpFileName\n);\nHMODULE LoadLibraryExA (\n LPCSTR lpLibFileName,\n HANDLE hFile,\n DWORD dwFlags\n);\n// To load a Win32 DLL in a Universal Windows Platform (UWP) application, you need to call LoadPackagedLibrary instead of LoadLibrary or LoadLibraryEx\nHMODULE LoadPackagedLibrary (\n LPCWSTR lpwLibFileName,\n DWORD Reserved\n);\n\n// uninstall library\nBOOL WINAPI FreeLibrary (\n _In_ HMODULE hModule\n);\n// Unload the library and exit the thread\nVOID WINAPI FreeLibraryAndExitThread(\n _In_ HMODULE hModule,\n _In_ DWORD dwExitCode\n);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e load library\u003c/span\u003e\nHMODULE WINAPI \u003cspan class=\"pl-en\"\u003eLoadLibrary\u003c/span\u003e (\n _In_ LPCTSTR lpFileName\n);\nHMODULE \u003cspan class=\"pl-en\"\u003eLoadLibraryExA\u003c/span\u003e (\n LPCSTR lpLibFileName,\n HANDLE hFile,\n DWORD dwFlags\n);\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e To load a Win32 DLL in a Universal Windows Platform (UWP) application, you need to call LoadPackagedLibrary instead of LoadLibrary or LoadLibraryEx\u003c/span\u003e\nHMODULE \u003cspan class=\"pl-en\"\u003eLoadPackagedLibrary\u003c/span\u003e (\n LPCWSTR lpwLibFileName,\n DWORD Reserved\n);\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e uninstall library\u003c/span\u003e\nBOOL WINAPI \u003cspan class=\"pl-en\"\u003eFreeLibrary\u003c/span\u003e (\n _In_ HMODULE hModule\n);\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Unload the library and exit the thread\u003c/span\u003e\nVOID WINAPI \u003cspan class=\"pl-en\"\u003eFreeLibraryAndExitThread\u003c/span\u003e(\n _In_ HMODULE hModule,\n _In_ DWORD dwExitCode\n);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDisplay link to export symbol\u003c/h4\u003e\u003ca id=\"user-content-display-link-to-export-symbol\" class=\"anchor\" aria-label=\"Permalink: Display link to export symbol\" href=\"#display-link-to-export-symbol\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eGetProcAddress function declaration\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"FARPROC GetProcAddress (\n HMODULE hInstDll,\n PCSTR pszSymbolName // Can only accept ANSI strings, not Unicode\n);\"\u003e\u003cpre\u003eFARPROC \u003cspan class=\"pl-en\"\u003eGetProcAddress\u003c/span\u003e (\n HMODULE hInstDll,\n PCSTR pszSymbolName \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Can only accept ANSI strings, not Unicode\u003c/span\u003e\n);\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDumpBin.exe View DLL information\u003c/h4\u003e\u003ca id=\"user-content-dumpbinexe-view-dll-information\" class=\"anchor\" aria-label=\"Permalink: DumpBin.exe View DLL information\" href=\"#dumpbinexe-view-dll-information\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eUse \u003ccode\u003eDumpBin.exe\u003c/code\u003e in the\u003ccode\u003e VS Developer Command Prompt\u003c/code\u003e to view the exported section of the DLL library (exported variables, functions, symbols of class names), relative virtual addresses (RVA). Such as:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"DUMPBIN -exports D: \\ mydll.dll\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003eDUMPBIN -exports D: \\ mydll.dll\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFlow chart of LoadLibrary and FreeLibrary\u003c/h4\u003e\u003ca id=\"user-content-flow-chart-of-loadlibrary-and-freelibrary\" class=\"anchor\" aria-label=\"Permalink: Flow chart of LoadLibrary and FreeLibrary\" href=\"#flow-chart-of-loadlibrary-and-freelibrary\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eLoadLibrary and FreeLibrary flowchart\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLoadLibrary\u003c/h5\u003e\u003ca id=\"user-content-loadlibrary\" class=\"anchor\" aria-label=\"Permalink: LoadLibrary\" href=\"#loadlibrary\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/WindowsLoadLibrary.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/WindowsLoadLibrary.png\" alt=\"WindowsLoadLibrary\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch5 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eFreeLibrary\u003c/h5\u003e\u003ca id=\"user-content-freelibrary\" class=\"anchor\" aria-label=\"Permalink: FreeLibrary\" href=\"#freelibrary\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://raw.githubusercontent.com/huihut/interview/master/images/WindowsFreeLibrary.png\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/huihut/interview/master/images/WindowsFreeLibrary.png\" alt=\"WindowsFreeLibrary\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eWriting of DLL library (export a DLL module)\u003c/h4\u003e\u003ca id=\"user-content-writing-of-dll-library-export-a-dll-module\" class=\"anchor\" aria-label=\"Permalink: Writing of DLL library (export a DLL module)\" href=\"#writing-of-dll-library-export-a-dll-module\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eWriting DLL library (export a DLL module)\nDLL header file\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// MyLib.h\n\n#ifdef MYLIBAPI\n\n// MYLIBAPI should be defined before include \u0026quot;Mylib.h\u0026quot; in all DLL source files\n// All functions / variables are being exported\n\n#else\n\n// This header file is included by an exe source code module, which means that all functions / variables are imported\n#define MYLIBAPI extern \u0026quot;C\u0026quot; __declspec (dllimport)\n\n#endif\n\n// Define any data structure and symbol here\n\n// Define exported variables (avoid exporting variables)\nMYLIBAPI int g_nResult;\n\n// Define the prototype of the exported function\nMYLIBAPI int Add(int nLeft, int nRight);\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e MyLib.h\u003c/span\u003e\n\n#\u003cspan class=\"pl-k\"\u003eifdef\u003c/span\u003e MYLIBAPI\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e MYLIBAPI should be defined before include \"Mylib.h\" in all DLL source files\u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e All functions / variables are being exported\u003c/span\u003e\n\n#\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e This header file is included by an exe source code module, which means that all functions / variables are imported\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003edefine\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eMYLIBAPI\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eextern\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eC\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e __declspec (dllimport)\n\n#\u003cspan class=\"pl-k\"\u003eendif\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Define any data structure and symbol here\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Define exported variables (avoid exporting variables)\u003c/span\u003e\nMYLIBAPI \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e g_nResult;\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Define the prototype of the exported function\u003c/span\u003e\nMYLIBAPI \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eAdd\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e nLeft, \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e nRight);\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eDLL source files\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// MyLibFile1.cpp\n\n// Contains standard Windows and C runtime header files\n#include \u0026lt;windows.h\u0026gt;\n\n// Functions and variables exported from DLL source files\n#define MYLIBAPI extern \u0026quot;C\u0026quot; __declspec (dllexport)\n\n// Contains exported data structures, symbols, functions, variables\n#include \u0026quot;MyLib.h\u0026quot;\n\n// Put the code of this DLL source code file here\nint g_nResult;\n\nint Add(int nLeft, int nRight)\n{\n g_nResult = nLeft + nRight;\n return g_nResult;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e MyLibFile1.cpp\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Contains standard Windows and C runtime header files\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003ewindows.h\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Functions and variables exported from DLL source files\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003edefine\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eMYLIBAPI\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eextern\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eC\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e __declspec (dllexport)\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Contains exported data structures, symbols, functions, variables\u003c/span\u003e\n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eMyLib.h\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e\n\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Put the code of this DLL source code file here\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e g_nResult;\n\n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eAdd\u003c/span\u003e(\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e nLeft, \u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e nRight)\n{\n g_nResult = nLeft + nRight;\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e g_nResult;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUse of DLL library (dynamic link DLL at runtime)\u003c/h4\u003e\u003ca id=\"user-content-use-of-dll-library-dynamic-link-dll-at-runtime\" class=\"anchor\" aria-label=\"Permalink: Use of DLL library (dynamic link DLL at runtime)\" href=\"#use-of-dll-library-dynamic-link-dll-at-runtime\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eUse of DLL libraries (dynamically linking DLLs at runtime)\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-c++ notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"// A simple program that uses LoadLibrary and \n// GetProcAddress to access myPuts from Myputs.dll. \n \n#include \u0026lt;windows.h\u0026gt; \n#include \u0026lt;stdio.h\u0026gt; \n \ntypedef int (__cdecl *MYPROC)(LPWSTR); \n \nint main( void ) \n{ \n HINSTANCE hinstLib; \n MYPROC ProcAdd; \n BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; \n \n // Get a handle to the DLL module.\n \n hinstLib = LoadLibrary(TEXT(\u0026quot;MyPuts.dll\u0026quot;)); \n \n // If the handle is valid, try to get the function address.\n \n if (hinstLib != NULL) \n { \n ProcAdd = (MYPROC) GetProcAddress(hinstLib, \u0026quot;myPuts\u0026quot;); \n \n // If the function address is valid, call the function.\n \n if (NULL != ProcAdd) \n {\n fRunTimeLinkSuccess = TRUE;\n (ProcAdd) (L\u0026quot;Message sent to the DLL function\\n\u0026quot;); \n }\n // Free the DLL module.\n \n fFreeResult = FreeLibrary(hinstLib); \n } \n\n // If unable to call the DLL function, use an alternative.\n if (! fRunTimeLinkSuccess) \n printf(\u0026quot;Message printed from executable\\n\u0026quot;); \n\n return 0;\n}\"\u003e\u003cpre\u003e\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e A simple program that uses LoadLibrary and \u003c/span\u003e\n\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e GetProcAddress to access myPuts from Myputs.dll. \u003c/span\u003e\n \n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003ewindows.h\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e \n#\u003cspan class=\"pl-k\"\u003einclude\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\u0026lt;\u003c/span\u003estdio.h\u003cspan class=\"pl-pds\"\u003e\u0026gt;\u003c/span\u003e\u003c/span\u003e \n \n\u003cspan class=\"pl-k\"\u003etypedef\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eint\u003c/span\u003e (__cdecl *MYPROC)(LPWSTR); \n \n\u003cspan class=\"pl-k\"\u003eint\u003c/span\u003e \u003cspan class=\"pl-en\"\u003emain\u003c/span\u003e( \u003cspan class=\"pl-k\"\u003evoid\u003c/span\u003e ) \n{ \n HINSTANCE hinstLib; \n MYPROC ProcAdd; \n BOOL \u003cspan class=\"pl-smi\"\u003efFreeResult\u003c/span\u003e, \u003cspan class=\"pl-smi\"\u003efRunTimeLinkSuccess\u003c/span\u003e = \u003cspan class=\"pl-c1\"\u003eFALSE\u003c/span\u003e; \n \n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Get a handle to the DLL module.\u003c/span\u003e\n \n hinstLib = \u003cspan class=\"pl-c1\"\u003eLoadLibrary\u003c/span\u003e(\u003cspan class=\"pl-c1\"\u003eTEXT\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eMyPuts.dll\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e)); \n \n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e If the handle is valid, try to get the function address.\u003c/span\u003e\n \n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (hinstLib != \u003cspan class=\"pl-c1\"\u003eNULL\u003c/span\u003e) \n { \n ProcAdd = (MYPROC) \u003cspan class=\"pl-c1\"\u003eGetProcAddress\u003c/span\u003e(hinstLib, \u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003emyPuts\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e); \n \n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e If the function address is valid, call the function.\u003c/span\u003e\n \n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (\u003cspan class=\"pl-c1\"\u003eNULL\u003c/span\u003e != ProcAdd) \n {\n \u003cspan class=\"pl-smi\"\u003efRunTimeLinkSuccess\u003c/span\u003e = \u003cspan class=\"pl-c1\"\u003eTRUE\u003c/span\u003e;\n (ProcAdd) (\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003eL\"\u003c/span\u003eMessage sent to the DLL function\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e); \n }\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e Free the DLL module.\u003c/span\u003e\n \n \u003cspan class=\"pl-smi\"\u003efFreeResult\u003c/span\u003e = \u003cspan class=\"pl-c1\"\u003eFreeLibrary\u003c/span\u003e(hinstLib); \n } \n\n \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e//\u003c/span\u003e If unable to call the DLL function, use an alternative.\u003c/span\u003e\n \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e (! \u003cspan class=\"pl-smi\"\u003efRunTimeLinkSuccess\u003c/span\u003e) \n \u003cspan class=\"pl-c1\"\u003eprintf\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003eMessage printed from executable\u003cspan class=\"pl-cce\"\u003e\\n\u003c/span\u003e\u003cspan class=\"pl-pds\"\u003e\"\u003c/span\u003e\u003c/span\u003e); \n\n \u003cspan class=\"pl-k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e0\u003c/span\u003e;\n}\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRuntime(Runtime Library)\u003c/h3\u003e\u003ca id=\"user-content-runtimeruntime-library\" class=\"anchor\" aria-label=\"Permalink: Runtime(Runtime Library)\" href=\"#runtimeruntime-library\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTypical program operation steps\u003c/h4\u003e\u003ca id=\"user-content-typical-program-operation-steps\" class=\"anchor\" aria-label=\"Permalink: Typical program operation steps\" href=\"#typical-program-operation-steps\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eThe operating system creates a process and passes control to the entry point of the program (often an entry function in the runtime library)\u003c/li\u003e\n\u003cli\u003eThe entry function initializes the runtime library and program running environment (including heap, I / O, threads, global variable construction, etc.).\u003c/li\u003e\n\u003cli\u003eAfter the entry function is initialized, the main function is called to officially start executing the main part of the program.\u003c/li\u003e\n\u003cli\u003eAfter the main function finishes executing, return to the entry function for cleanup (including global variable destruction, heap destruction, closing I / O, etc.), and then make a system call to end the process.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eI / O of a program refers to the interaction between the program and the outside world, including files, management programs, network, command line, signals, etc. More broadly, I / O refers to what the operating system understands as a \"file.\"\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eglibc entry\u003c/h4\u003e\u003ca id=\"user-content-glibc-entry\" class=\"anchor\" aria-label=\"Permalink: glibc entry\" href=\"#glibc-entry\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003e_start-\u0026gt; __libc_start_main-\u0026gt; exit-\u0026gt; _exit\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe \u003ccode\u003emain (argc, argv, __environ)\u003c/code\u003e function is executed in \u003ccode\u003e__libc_start_main\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eMSVC CRT Entry\u003c/h4\u003e\u003ca id=\"user-content-msvc-crt-entry\" class=\"anchor\" aria-label=\"Permalink: MSVC CRT Entry\" href=\"#msvc-crt-entry\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003eint mainCRTStartup (void)\u003c/code\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eDo the following:\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eInitialize global variables related to the OS version.\u003c/li\u003e\n\u003cli\u003eInitialize the heap.\u003c/li\u003e\n\u003cli\u003eInitialize I / O.\u003c/li\u003e\n\u003cli\u003eGet command line parameters and environment variables.\u003c/li\u003e\n\u003cli\u003eInitialize some data of the C library.\u003c/li\u003e\n\u003cli\u003eCall main and record the return value.\u003c/li\u003e\n\u003cli\u003eCheck for errors and return the return value of main.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eC Language Runtime (CRT)\u003c/h4\u003e\u003ca id=\"user-content-c-language-runtime-crt\" class=\"anchor\" aria-label=\"Permalink: C Language Runtime (CRT)\" href=\"#c-language-runtime-crt\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eIt contains the following functions:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eStart and exit: including entry functions and other functions on which entry functions depend.\u003c/li\u003e\n\u003cli\u003eStandard functions: There are functions implemented by the C language standard library specified by the C language standard.\u003c/li\u003e\n\u003cli\u003eI/O: Encapsulation and implementation of I / O functions.\u003c/li\u003e\n\u003cli\u003eHeap: Encapsulation and implementation of the heap.\u003c/li\u003e\n\u003cli\u003eLanguage implementation: implementation of some special functions in the language.\u003c/li\u003e\n\u003cli\u003eDebugging: Code that implements debugging functions.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eC Language Standard Library (ANSI C)\u003c/h4\u003e\u003ca id=\"user-content-c-language-standard-library-ansi-c\" class=\"anchor\" aria-label=\"Permalink: C Language Standard Library (ANSI C)\" href=\"#c-language-standard-library-ansi-c\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003econtain:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eStandard input and output (stdio.h)\u003c/li\u003e\n\u003cli\u003eFile operations (stdio.h)\u003c/li\u003e\n\u003cli\u003eCharacter manipulation (ctype.h)\u003c/li\u003e\n\u003cli\u003eString operations (string.h)\u003c/li\u003e\n\u003cli\u003eMathematical functions (math.h)\u003c/li\u003e\n\u003cli\u003eResource Management (stdlib.h)\u003c/li\u003e\n\u003cli\u003eFormat conversion (stdlib.h)\u003c/li\u003e\n\u003cli\u003eTime / Date (time.h)\u003c/li\u003e\n\u003cli\u003eAssertions (assert.h)\u003c/li\u003e\n\u003cli\u003eConstants on various types (limits.h \u0026amp; float.h)\u003c/li\u003e\n\u003cli\u003eVariable length parameter (stdarg.h)\u003c/li\u003e\n\u003cli\u003eNon-local jump (setjmp.h)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-books\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e📚 Books\u003c/h2\u003e\u003ca id=\"user-content--books\" class=\"anchor\" aria-label=\"Permalink: 📚 Books\" href=\"#-books\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/huihut/CS-Books\"\u003ehuihut/CS-Books\u003c/a\u003e:📚 Computer Technology Books PDF\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eLanguage\u003c/h3\u003e\u003ca id=\"user-content-language\" class=\"anchor\" aria-label=\"Permalink: Language\" href=\"#language\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\"C ++ Primer\"\u003c/li\u003e\n\u003cli\u003e\"Effective C ++\"\u003c/li\u003e\n\u003cli\u003e\"More Effective C ++\"\u003c/li\u003e\n\u003cli\u003e\"Exploring the C ++ Object Model\"\u003c/li\u003e\n\u003cli\u003e\"Understanding C ++ 11\"\u003c/li\u003e\n\u003cli\u003e\"Anatomy of STL Source Code\"\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAlgorithm\u003c/h3\u003e\u003ca id=\"user-content-algorithm-1\" class=\"anchor\" aria-label=\"Permalink: Algorithm\" href=\"#algorithm-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\"Sword Finger Offer\"\u003c/li\u003e\n\u003cli\u003e\"Programming Pearls\"\u003c/li\u003e\n\u003cli\u003e\"Programmer Interview Collection\"\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eSystem\u003c/h3\u003e\u003ca id=\"user-content-system\" class=\"anchor\" aria-label=\"Permalink: System\" href=\"#system\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\"Understanding Computer Systems\"\u003c/li\u003e\n\u003cli\u003e\"Windows Core Programming\"\u003c/li\u003e\n\u003cli\u003e\"Advanced Programming in the Unix Environment\"\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eThe internet\u003c/h3\u003e\u003ca id=\"user-content-the-internet\" class=\"anchor\" aria-label=\"Permalink: The internet\" href=\"#the-internet\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\"Unix Network Programming\"\u003c/li\u003e\n\u003cli\u003e\"Detailed Explanation of TCP / IP\"\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eOther\u003c/h3\u003e\u003ca id=\"user-content-other-1\" class=\"anchor\" aria-label=\"Permalink: Other\" href=\"#other-1\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\"The Self-Cultivation of Programmers\"\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-cc-development-direction\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e🔱 C / C ++ Development Direction\u003c/h2\u003e\u003ca id=\"user-content--c--c--development-direction\" class=\"anchor\" aria-label=\"Permalink: 🔱 C / C ++ Development Direction\" href=\"#-c--c--development-direction\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003eThe development direction of C / C ++ is very wide, including not limited to the following directions. The following are some of the requirements for recruiting positions of big factories and schools.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eBackend / Server\u003c/h3\u003e\u003ca id=\"user-content-backend--server\" class=\"anchor\" aria-label=\"Permalink: Backend / Server\" href=\"#backend--server\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[Backend Development]\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eSolid basic programming skills, master C / C ++ / JAVA and other development languages, commonly used algorithms and data structures;\u003c/li\u003e\n\u003cli\u003eFamiliar with TCP / UDP network protocol and related programming, inter-process communication programming;\u003c/li\u003e\n\u003cli\u003eUnderstanding Python, Shell, Perl and other scripting languages;\u003c/li\u003e\n\u003cli\u003eUnderstand MYSQL, SQL language, programming, NoSQL, key-value storage principle;\u003c/li\u003e\n\u003cli\u003eComprehensive and solid software knowledge structure, mastering professional knowledge of operating systems, software engineering, design patterns, data structures, database systems, and network security;\u003c/li\u003e\n\u003cli\u003eUnderstand the knowledge of distributed system design and development, load balancing technology, system disaster recovery design, and high availability systems.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDesktop Client\u003c/h3\u003e\u003ca id=\"user-content-desktop-client\" class=\"anchor\" aria-label=\"Permalink: Desktop Client\" href=\"#desktop-client\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[PC client development]\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBachelor degree or above in computer software, majoring in programming, solid foundation, understanding of algorithms and data structure;\u003c/li\u003e\n\u003cli\u003eFamiliar with memory management, file system, process thread scheduling of windows operating system;\u003c/li\u003e\n\u003cli\u003eFamiliar with MFC / windows interface implementation mechanism, proficient in VC, proficient in C / C ++, proficient in STL, and network programming experience under Windows;\u003c/li\u003e\n\u003cli\u003eFamiliar with Windows client development and debugging, Windows application software development experience is preferred;\u003c/li\u003e\n\u003cli\u003ePassionate about innovation and solving challenging problems, with good algorithm foundation and system analysis ability.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eGraphics / Game / VR / AR\u003c/h3\u003e\u003ca id=\"user-content-graphics--game--vr--ar\" class=\"anchor\" aria-label=\"Permalink: Graphics / Game / VR / AR\" href=\"#graphics--game--vr--ar\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[Game Client Development]\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBachelor degree or above in computer science / engineering major, passion for programming, solid foundation, understanding of algorithms, data structure, software design related knowledge;\u003c/li\u003e\n\u003cli\u003eAt least one programming language commonly used in game development, C ++ / C # programming experience is preferred;\u003c/li\u003e\n\u003cli\u003eExperience with game engines (such as Unity, Unreal) is preferred;\u003c/li\u003e\n\u003cli\u003eKnowledge of game client technology (such as graphics, audio, animation, physics, artificial intelligence, network synchronization) is preferred;\u003c/li\u003e\n\u003cli\u003ePassionate about innovation and solving challenging problems, strong learning ability, analytical and problem solving skills, and a good sense of teamwork;\u003c/li\u003e\n\u003cli\u003eAbility to read English technical documents;\u003c/li\u003e\n\u003cli\u003eLove games.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eTest Development\u003c/h3\u003e\u003ca id=\"user-content-test-development\" class=\"anchor\" aria-label=\"Permalink: Test Development\" href=\"#test-development\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[Test Development]\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eBachelor degree or above in computer or related field;\u003c/li\u003e\n\u003cli\u003eOne to two years of programming experience in C / C ++ / Python or other computer languages;\u003c/li\u003e\n\u003cli\u003eAbility to write test plans, test cases, and achieve performance and safety tests;\u003c/li\u003e\n\u003cli\u003eAbility to implement automated systems;\u003c/li\u003e\n\u003cli\u003eAbility to locate and investigate product defects and code-level debugging defects;\u003c/li\u003e\n\u003cli\u003eWork proactively, have a sense of responsibility, and have a good team spirit.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCyber Security / Reverse\u003c/h3\u003e\u003ca id=\"user-content-cyber-security--reverse\" class=\"anchor\" aria-label=\"Permalink: Cyber Security / Reverse\" href=\"#cyber-security--reverse\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[safety technology]\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eLove the Internet, have a passionate pursuit of operating systems and network security, and professionalism is not limited;\u003c/li\u003e\n\u003cli\u003eFamiliar with vulnerability mining, network security attack and defense technologies, and common hacking techniques;\u003c/li\u003e\n\u003cli\u003eMaster basic development skills and be proficient in C / C ++ language;\u003c/li\u003e\n\u003cli\u003eHave a good grasp of database, operating system and network principles;\u003c/li\u003e\n\u003cli\u003eExperience in software reverse, network security attack and defense or security system development is preferred.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eEmbedded / IoT\u003c/h3\u003e\u003ca id=\"user-content-embedded--iot\" class=\"anchor\" aria-label=\"Permalink: Embedded / IoT\" href=\"#embedded--iot\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[Embedded Application Development]\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eHave a good programming foundation, proficient in C / C ++ language;\u003c/li\u003e\n\u003cli\u003eMaster the necessary knowledge for software development such as operating system and data structure;\u003c/li\u003e\n\u003cli\u003eStrong communication and understanding ability and good teamwork awareness;\u003c/li\u003e\n\u003cli\u003eDevelopment experience on Linux / Android system platform is preferred.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eAudio / Video / Streaming / SDK\u003c/h3\u003e\u003ca id=\"user-content-audio--video--streaming--sdk\" class=\"anchor\" aria-label=\"Permalink: Audio / Video / Streaming / SDK\" href=\"#audio--video--streaming--sdk\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[Audio and video codec]\u003c/p\u003e\n\u003col dir=\"auto\"\u003e\n\u003cli\u003eMaster's degree or above, computer, signal processing, mathematics, information and related majors and directions;\u003c/li\u003e\n\u003cli\u003eSolid video coding and decoding foundation, familiar with commonly used HEVC or H264, have a good digital signal processing foundation;\u003c/li\u003e\n\u003cli\u003eMaster C / C ++, strong code ability, familiar with an assembly language is preferred;\u003c/li\u003e\n\u003cli\u003eStrong English literature reading ability;\u003c/li\u003e\n\u003cli\u003eStrong learning ability, teamwork spirit, and strong resistance to stress.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eComputer Vision / Machine Learning\u003c/h3\u003e\u003ca id=\"user-content-computer-vision--machine-learning\" class=\"anchor\" aria-label=\"Permalink: Computer Vision / Machine Learning\" href=\"#computer-vision--machine-learning\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e[Computer Vision Research]\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eComputer, applied mathematics, pattern recognition, artificial intelligence, automatic control, statistics, operations research, bioinformatics, physics / quantum computing, neuroscience, sociology / psychology and other majors, image processing, pattern recognition, machine learning related research Direction, undergraduate and above, doctoral degree is preferred;\u003c/li\u003e\n\u003cli\u003eProficient in basic algorithms and applications related to computer vision and image processing;\u003c/li\u003e\n\u003cli\u003eStrong algorithm implementation ability, proficient in C / C ++ programming, familiar with at least one programming language of Shell / Python / Matlab;\u003c/li\u003e\n\u003cli\u003ePublication of papers in computer vision, pattern recognition and other academic conferences or journals, awards in relevant international competitions, and related patents are preferred.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-review-of-brush-questions-website\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e💯 Review brush question website\u003c/h2\u003e\u003ca id=\"user-content--review-brush-question-website\" class=\"anchor\" aria-label=\"Permalink: 💯 Review brush question website\" href=\"#-review-brush-question-website\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"http://www.cplusplus.com/\" rel=\"nofollow\"\u003ecplusplus\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://zh.cppreference.com/w/%E9%A6%96%E9%A1%B5\" rel=\"nofollow\"\u003ecppreference\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://www.runoob.com/cplusplus/cpp-tutorial.html\" rel=\"nofollow\"\u003erunoob\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://leetcode.com/\" rel=\"nofollow\"\u003eleetcode\u003c/a\u003e | \u003ca href=\"https://leetcode-cn.com/\" rel=\"nofollow\"\u003eleetcode-cn\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.lintcode.com/\" rel=\"nofollow\"\u003elintcode\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.net/\" rel=\"nofollow\"\u003enowcoder\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-interview-questions-experience\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e📝 Interview Question Experience\u003c/h2\u003e\u003ca id=\"user-content--interview-question-experience\" class=\"anchor\" aria-label=\"Permalink: 📝 Interview Question Experience\" href=\"#-interview-question-experience\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/205497\" rel=\"nofollow\"\u003eNowcoder.com's summary of the 2020 autumn tricks! (Post division)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/197116\" rel=\"nofollow\"\u003e【Preparation for Autumn Moves】 Raiders for 2020 Autumn Moves\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/90907\" rel=\"nofollow\"\u003e2019 School Recruitment Summary! 【Daily Update】\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/146655\" rel=\"nofollow\"\u003e2019 School Recruitment Technology Posts Summary [Technology]\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/68802\" rel=\"nofollow\"\u003e2018 School Recruitment Questions Summary\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/12805\" rel=\"nofollow\"\u003e2017 Autumn Campus Recruitment Pen and Face Summaries\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/25268\" rel=\"nofollow\"\u003eThe most complete collection of 2017 spring tricks in history!!\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/discuss/57978\" rel=\"nofollow\"\u003eInterview questions are here\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.zhihu.com/question/29693016\" rel=\"nofollow\"\u003ezhihu. On the Internet job search, what well-written and attentive face have you seen? It is best to share your own facial and mental journey. \u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.zhihu.com/question/24964987\" rel=\"nofollow\"\u003ezhihu. What are the most common interview algorithm questions for internet companies? \u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://blog.csdn.net/ljzcome/article/details/574158\" rel=\"nofollow\"\u003eCSDN. C ++ Interview Questions Completely Organized\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://blog.csdn.net/Xiongchao99/article/details/74524807?locationNum=6\u0026amp;fps=1\" rel=\"nofollow\"\u003eCSDN. Baidu R \u0026amp; D interview questions (C ++ direction)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://blog.csdn.net/fakine/article/details/51321544\" rel=\"nofollow\"\u003eCSDN. C ++ 30 common interview questions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"http://blog.csdn.net/onever_say_love/article/details/51223886\" rel=\"nofollow\"\u003eCSDN. Tencent 2016 intern interview experience (already got offer)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.cnblogs.com/Y1Focus/p/6707121.html\" rel=\"nofollow\"\u003ecnblogs. C ++ Interview Collection (Questions Asked for Interview)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.cnblogs.com/fangyukuan/archive/2010/09/18/1829871.html\" rel=\"nofollow\"\u003ecnblogs. C / C ++ written and interview questions summary\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.cnblogs.com/LUO77/p/5771237.html\" rel=\"nofollow\"\u003ecnblogs. Summary of common C ++ interview questions and basic knowledge points (1)\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://segmentfault.com/a/1190000003745529\" rel=\"nofollow\"\u003esegmentfault. Summary of common interview questions in C ++\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-recruitment-time-post\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e📆 Recruiting time posts\u003c/h2\u003e\u003ca id=\"user-content--recruiting-time-posts\" class=\"anchor\" aria-label=\"Permalink: 📆 Recruiting time posts\" href=\"#-recruiting-time-posts\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://www.nowcoder.com/school/schedule\" rel=\"nofollow\"\u003enowcoder . Enterprise Recruitment Schedule\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-recommend\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e👍 Recommend\u003c/h2\u003e\u003ca id=\"user-content--recommend\" class=\"anchor\" aria-label=\"Permalink: 👍 Recommend\" href=\"#-recommend\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/CyC2018/Job-Recommend\"\u003eGithub. CyC2018 / Job-Recommend\u003c/a\u003e: 🔎 Internet internal push information (social recruitment, school recruitment, internship)\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/amusi/AI-Job-Recommend\"\u003eGithub. Amusi / AI-Job-Recommend\u003c/a\u003e: direction of artificial intelligence of domestic companies (including machine learning, deep learning, computer vision and natural language processing) Job recruitment information (including full-time, internship and school recruitment)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-contributor\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e👬 Contributor\u003c/h2\u003e\u003ca id=\"user-content--contributor\" class=\"anchor\" aria-label=\"Permalink: 👬 Contributor\" href=\"#-contributor\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/huihut/interview/graphs/contributors\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/86658d4c823f5138371c2f0c206265ec7e70331d656208dac5315711fd3beb40/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f696e746572766965772f636f6e7472696275746f72732e7376673f627574746f6e3d66616c7365\" data-canonical-src=\"https://opencollective.com/interview/contributors.svg?button=false\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca id=\"user-content-license\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003e📜 License\u003c/h2\u003e\u003ca id=\"user-content--license\" class=\"anchor\" aria-label=\"Permalink: 📜 License\" href=\"#-license\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis repository follows the CC BY-NC-SA 4.0 (signed-non-commercial use-shared in the same way) agreement, please indicate the source when reprinting, and should not be used for commercial purposes.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://github.com/huihut/interview/blob/master/LICENSE\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/62be294f71c9a1885f9cd8f54aa8b8bd42d432fd14b5393a8b25bcd1f34daa42/68747470733a2f2f692e6372656174697665636f6d6d6f6e732e6f72672f6c2f62792d6e632d73612f342e302f38387833312e706e67\" alt=\"CC BY-NC-SA 4.0\" data-canonical-src=\"https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/article\u003e","renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"📑 Table of contents","kind":"section_2","ident_start":1866,"ident_end":1888,"extent_start":1863,"extent_end":2712,"fully_qualified_name":"📑 Table of contents","ident_utf16":{"start":{"line_number":29,"utf16_col":3},"end":{"line_number":29,"utf16_col":23}},"extent_utf16":{"start":{"line_number":29,"utf16_col":0},"end":{"line_number":56,"utf16_col":0}}},{"name":"➕ C/C++","kind":"section_2","ident_start":2715,"ident_end":2724,"extent_start":2712,"extent_end":50184,"fully_qualified_name":"➕ C/C++","ident_utf16":{"start":{"line_number":56,"utf16_col":3},"end":{"line_number":56,"utf16_col":10}},"extent_utf16":{"start":{"line_number":56,"utf16_col":0},"end":{"line_number":1231,"utf16_col":0}}},{"name":"const","kind":"section_3","ident_start":2730,"ident_end":2735,"extent_start":2726,"extent_end":6242,"fully_qualified_name":"const","ident_utf16":{"start":{"line_number":58,"utf16_col":4},"end":{"line_number":58,"utf16_col":9}},"extent_utf16":{"start":{"line_number":58,"utf16_col":0},"end":{"line_number":139,"utf16_col":0}}},{"name":"Function","kind":"section_4","ident_start":2742,"ident_end":2750,"extent_start":2737,"extent_end":3245,"fully_qualified_name":"Function","ident_utf16":{"start":{"line_number":60,"utf16_col":5},"end":{"line_number":60,"utf16_col":13}},"extent_utf16":{"start":{"line_number":60,"utf16_col":0},"end":{"line_number":67,"utf16_col":0}}},{"name":"const Pointers and references","kind":"section_4","ident_start":3250,"ident_end":3279,"extent_start":3245,"extent_end":3663,"fully_qualified_name":"const Pointers and references","ident_utf16":{"start":{"line_number":67,"utf16_col":5},"end":{"line_number":67,"utf16_col":34}},"extent_utf16":{"start":{"line_number":67,"utf16_col":0},"end":{"line_number":79,"utf16_col":0}}},{"name":"use","kind":"section_4","ident_start":3668,"ident_end":3671,"extent_start":3663,"extent_end":5860,"fully_qualified_name":"use","ident_utf16":{"start":{"line_number":79,"utf16_col":5},"end":{"line_number":79,"utf16_col":8}},"extent_utf16":{"start":{"line_number":79,"utf16_col":0},"end":{"line_number":128,"utf16_col":0}}},{"name":"#define and const constants","kind":"section_4","ident_start":5865,"ident_end":5892,"extent_start":5860,"extent_end":6242,"fully_qualified_name":"#define and const constants","ident_utf16":{"start":{"line_number":128,"utf16_col":5},"end":{"line_number":128,"utf16_col":32}},"extent_utf16":{"start":{"line_number":128,"utf16_col":0},"end":{"line_number":139,"utf16_col":0}}},{"name":"static","kind":"section_3","ident_start":6246,"ident_end":6252,"extent_start":6242,"extent_end":7249,"fully_qualified_name":"static","ident_utf16":{"start":{"line_number":139,"utf16_col":4},"end":{"line_number":139,"utf16_col":10}},"extent_utf16":{"start":{"line_number":139,"utf16_col":0},"end":{"line_number":148,"utf16_col":0}}},{"name":"Function","kind":"section_4","ident_start":6259,"ident_end":6267,"extent_start":6254,"extent_end":7249,"fully_qualified_name":"Function","ident_utf16":{"start":{"line_number":141,"utf16_col":5},"end":{"line_number":141,"utf16_col":13}},"extent_utf16":{"start":{"line_number":141,"utf16_col":0},"end":{"line_number":148,"utf16_col":0}}},{"name":"this pointer","kind":"section_3","ident_start":7253,"ident_end":7265,"extent_start":7249,"extent_end":8599,"fully_qualified_name":"this pointer","ident_utf16":{"start":{"line_number":148,"utf16_col":4},"end":{"line_number":148,"utf16_col":16}},"extent_utf16":{"start":{"line_number":148,"utf16_col":0},"end":{"line_number":160,"utf16_col":0}}},{"name":"inline function","kind":"section_3","ident_start":8603,"ident_end":8618,"extent_start":8599,"extent_end":13588,"fully_qualified_name":"inline function","ident_utf16":{"start":{"line_number":160,"utf16_col":4},"end":{"line_number":160,"utf16_col":19}},"extent_utf16":{"start":{"line_number":160,"utf16_col":0},"end":{"line_number":268,"utf16_col":0}}},{"name":"Features","kind":"section_4","ident_start":8625,"ident_end":8633,"extent_start":8620,"extent_end":9209,"fully_qualified_name":"Features","ident_utf16":{"start":{"line_number":162,"utf16_col":5},"end":{"line_number":162,"utf16_col":13}},"extent_utf16":{"start":{"line_number":162,"utf16_col":0},"end":{"line_number":170,"utf16_col":0}}},{"name":"use","kind":"section_4","ident_start":9214,"ident_end":9217,"extent_start":9209,"extent_end":9764,"fully_qualified_name":"use","ident_utf16":{"start":{"line_number":170,"utf16_col":5},"end":{"line_number":170,"utf16_col":8}},"extent_utf16":{"start":{"line_number":170,"utf16_col":0},"end":{"line_number":196,"utf16_col":0}}},{"name":"Compiler processing steps for inline functions","kind":"section_4","ident_start":9769,"ident_end":9815,"extent_start":9764,"extent_end":10225,"fully_qualified_name":"Compiler processing steps for inline functions","ident_utf16":{"start":{"line_number":196,"utf16_col":5},"end":{"line_number":196,"utf16_col":51}},"extent_utf16":{"start":{"line_number":196,"utf16_col":0},"end":{"line_number":203,"utf16_col":0}}},{"name":"Advantages and disadvantages","kind":"section_4","ident_start":10230,"ident_end":10258,"extent_start":10225,"extent_end":11753,"fully_qualified_name":"Advantages and disadvantages","ident_utf16":{"start":{"line_number":203,"utf16_col":5},"end":{"line_number":203,"utf16_col":33}},"extent_utf16":{"start":{"line_number":203,"utf16_col":0},"end":{"line_number":218,"utf16_col":0}}},{"name":"Can a virtual function be an inline function?","kind":"section_4","ident_start":11758,"ident_end":11803,"extent_start":11753,"extent_end":13588,"fully_qualified_name":"Can a virtual function be an inline function?","ident_utf16":{"start":{"line_number":218,"utf16_col":5},"end":{"line_number":218,"utf16_col":50}},"extent_utf16":{"start":{"line_number":218,"utf16_col":0},"end":{"line_number":268,"utf16_col":0}}},{"name":"volatile","kind":"section_3","ident_start":13592,"ident_end":13600,"extent_start":13588,"extent_end":14222,"fully_qualified_name":"volatile","ident_utf16":{"start":{"line_number":268,"utf16_col":4},"end":{"line_number":268,"utf16_col":12}},"extent_utf16":{"start":{"line_number":268,"utf16_col":0},"end":{"line_number":279,"utf16_col":0}}},{"name":"assert()","kind":"section_3","ident_start":14226,"ident_end":14234,"extent_start":14222,"extent_end":14741,"fully_qualified_name":"assert()","ident_utf16":{"start":{"line_number":279,"utf16_col":4},"end":{"line_number":279,"utf16_col":12}},"extent_utf16":{"start":{"line_number":279,"utf16_col":0},"end":{"line_number":292,"utf16_col":0}}},{"name":"sizeof()","kind":"section_3","ident_start":14745,"ident_end":14753,"extent_start":14741,"extent_end":14894,"fully_qualified_name":"sizeof()","ident_utf16":{"start":{"line_number":292,"utf16_col":4},"end":{"line_number":292,"utf16_col":12}},"extent_utf16":{"start":{"line_number":292,"utf16_col":0},"end":{"line_number":297,"utf16_col":0}}},{"name":"#pragma pack(n)","kind":"section_3","ident_start":14898,"ident_end":14913,"extent_start":14894,"extent_end":15211,"fully_qualified_name":"#pragma pack(n)","ident_utf16":{"start":{"line_number":297,"utf16_col":4},"end":{"line_number":297,"utf16_col":19}},"extent_utf16":{"start":{"line_number":297,"utf16_col":0},"end":{"line_number":317,"utf16_col":0}}},{"name":"Bit field","kind":"section_3","ident_start":15215,"ident_end":15224,"extent_start":15211,"extent_end":15843,"fully_qualified_name":"Bit field","ident_utf16":{"start":{"line_number":317,"utf16_col":4},"end":{"line_number":317,"utf16_col":13}},"extent_utf16":{"start":{"line_number":317,"utf16_col":0},"end":{"line_number":329,"utf16_col":0}}},{"name":"extern \"C\"","kind":"section_3","ident_start":15847,"ident_end":15857,"extent_start":15843,"extent_end":16390,"fully_qualified_name":"extern \"C\"","ident_utf16":{"start":{"line_number":329,"utf16_col":4},"end":{"line_number":329,"utf16_col":14}},"extent_utf16":{"start":{"line_number":329,"utf16_col":0},"end":{"line_number":350,"utf16_col":0}}},{"name":"struct with typedef struct","kind":"section_3","ident_start":16394,"ident_end":16420,"extent_start":16390,"extent_end":17810,"fully_qualified_name":"struct with typedef struct","ident_utf16":{"start":{"line_number":350,"utf16_col":4},"end":{"line_number":350,"utf16_col":30}},"extent_utf16":{"start":{"line_number":350,"utf16_col":0},"end":{"line_number":411,"utf16_col":0}}},{"name":"In C","kind":"section_4","ident_start":16428,"ident_end":16432,"extent_start":16422,"extent_end":16774,"fully_qualified_name":"In C","ident_utf16":{"start":{"line_number":352,"utf16_col":6},"end":{"line_number":352,"utf16_col":10}},"extent_utf16":{"start":{"line_number":352,"utf16_col":0},"end":{"line_number":376,"utf16_col":0}}},{"name":"In C++","kind":"section_4","ident_start":16779,"ident_end":16785,"extent_start":16774,"extent_end":17810,"fully_qualified_name":"In C++","ident_utf16":{"start":{"line_number":376,"utf16_col":5},"end":{"line_number":376,"utf16_col":11}},"extent_utf16":{"start":{"line_number":376,"utf16_col":0},"end":{"line_number":411,"utf16_col":0}}},{"name":"struct and class in C ++","kind":"section_3","ident_start":17814,"ident_end":17838,"extent_start":17810,"extent_end":18346,"fully_qualified_name":"struct and class in C ++","ident_utf16":{"start":{"line_number":411,"utf16_col":4},"end":{"line_number":411,"utf16_col":28}},"extent_utf16":{"start":{"line_number":411,"utf16_col":0},"end":{"line_number":421,"utf16_col":0}}},{"name":"The difference","kind":"section_4","ident_start":17986,"ident_end":18000,"extent_start":17981,"extent_end":18346,"fully_qualified_name":"The difference","ident_utf16":{"start":{"line_number":415,"utf16_col":5},"end":{"line_number":415,"utf16_col":19}},"extent_utf16":{"start":{"line_number":415,"utf16_col":0},"end":{"line_number":421,"utf16_col":0}}},{"name":"union union","kind":"section_3","ident_start":18350,"ident_end":18361,"extent_start":18346,"extent_end":19554,"fully_qualified_name":"union union","ident_utf16":{"start":{"line_number":421,"utf16_col":4},"end":{"line_number":421,"utf16_col":15}},"extent_utf16":{"start":{"line_number":421,"utf16_col":0},"end":{"line_number":470,"utf16_col":0}}},{"name":"C implements C ++ classes","kind":"section_3","ident_start":19558,"ident_end":19583,"extent_start":19554,"extent_end":19969,"fully_qualified_name":"C implements C ++ classes","ident_utf16":{"start":{"line_number":470,"utf16_col":4},"end":{"line_number":470,"utf16_col":29}},"extent_utf16":{"start":{"line_number":470,"utf16_col":0},"end":{"line_number":480,"utf16_col":0}}},{"name":"explicit (keyword)","kind":"section_3","ident_start":19973,"ident_end":19991,"extent_start":19969,"extent_end":22101,"fully_qualified_name":"explicit (keyword)","ident_utf16":{"start":{"line_number":480,"utf16_col":4},"end":{"line_number":480,"utf16_col":22}},"extent_utf16":{"start":{"line_number":480,"utf16_col":0},"end":{"line_number":531,"utf16_col":0}}},{"name":"friend - friend class and friend function","kind":"section_3","ident_start":22105,"ident_end":22146,"extent_start":22101,"extent_end":22334,"fully_qualified_name":"friend - friend class and friend function","ident_utf16":{"start":{"line_number":531,"utf16_col":4},"end":{"line_number":531,"utf16_col":45}},"extent_utf16":{"start":{"line_number":531,"utf16_col":0},"end":{"line_number":539,"utf16_col":0}}},{"name":"using","kind":"section_3","ident_start":22338,"ident_end":22343,"extent_start":22334,"extent_end":24219,"fully_qualified_name":"using","ident_utf16":{"start":{"line_number":539,"utf16_col":4},"end":{"line_number":539,"utf16_col":9}},"extent_utf16":{"start":{"line_number":539,"utf16_col":0},"end":{"line_number":606,"utf16_col":0}}},{"name":"using statement","kind":"section_4","ident_start":22350,"ident_end":22365,"extent_start":22345,"extent_end":22564,"fully_qualified_name":"using statement","ident_utf16":{"start":{"line_number":541,"utf16_col":5},"end":{"line_number":541,"utf16_col":20}},"extent_utf16":{"start":{"line_number":541,"utf16_col":0},"end":{"line_number":549,"utf16_col":0}}},{"name":"Using declaration of constructor","kind":"section_4","ident_start":22569,"ident_end":22601,"extent_start":22564,"extent_end":23040,"fully_qualified_name":"Using declaration of constructor","ident_utf16":{"start":{"line_number":549,"utf16_col":5},"end":{"line_number":549,"utf16_col":37}},"extent_utf16":{"start":{"line_number":549,"utf16_col":0},"end":{"line_number":567,"utf16_col":0}}},{"name":"using instructions","kind":"section_4","ident_start":23045,"ident_end":23063,"extent_start":23040,"extent_end":23242,"fully_qualified_name":"using instructions","ident_utf16":{"start":{"line_number":567,"utf16_col":5},"end":{"line_number":567,"utf16_col":23}},"extent_utf16":{"start":{"line_number":567,"utf16_col":0},"end":{"line_number":575,"utf16_col":0}}},{"name":"Minimize `using directives` to pollute namespaces","kind":"section_4","ident_start":23247,"ident_end":23296,"extent_start":23242,"extent_end":24219,"fully_qualified_name":"Minimize `using directives` to pollute namespaces","ident_utf16":{"start":{"line_number":575,"utf16_col":5},"end":{"line_number":575,"utf16_col":54}},"extent_utf16":{"start":{"line_number":575,"utf16_col":0},"end":{"line_number":606,"utf16_col":0}}},{"name":":: scope resolution operator","kind":"section_3","ident_start":24223,"ident_end":24251,"extent_start":24219,"extent_end":25142,"fully_qualified_name":":: scope resolution operator","ident_utf16":{"start":{"line_number":606,"utf16_col":4},"end":{"line_number":606,"utf16_col":32}},"extent_utf16":{"start":{"line_number":606,"utf16_col":0},"end":{"line_number":642,"utf16_col":0}}},{"name":"classification","kind":"section_4","ident_start":24258,"ident_end":24272,"extent_start":24253,"extent_end":25142,"fully_qualified_name":"classification","ident_utf16":{"start":{"line_number":608,"utf16_col":5},"end":{"line_number":608,"utf16_col":19}},"extent_utf16":{"start":{"line_number":608,"utf16_col":0},"end":{"line_number":642,"utf16_col":0}}},{"name":"enum - enum type","kind":"section_3","ident_start":25146,"ident_end":25162,"extent_start":25142,"extent_end":25375,"fully_qualified_name":"enum - enum type","ident_utf16":{"start":{"line_number":642,"utf16_col":4},"end":{"line_number":642,"utf16_col":20}},"extent_utf16":{"start":{"line_number":642,"utf16_col":0},"end":{"line_number":657,"utf16_col":0}}},{"name":"Scoped Enumeration Type","kind":"section_4","ident_start":25169,"ident_end":25192,"extent_start":25164,"extent_end":25255,"fully_qualified_name":"Scoped Enumeration Type","ident_utf16":{"start":{"line_number":644,"utf16_col":5},"end":{"line_number":644,"utf16_col":28}},"extent_utf16":{"start":{"line_number":644,"utf16_col":0},"end":{"line_number":650,"utf16_col":0}}},{"name":"Unscoped enumeration type","kind":"section_4","ident_start":25260,"ident_end":25285,"extent_start":25255,"extent_end":25375,"fully_qualified_name":"Unscoped enumeration type","ident_utf16":{"start":{"line_number":650,"utf16_col":5},"end":{"line_number":650,"utf16_col":30}},"extent_utf16":{"start":{"line_number":650,"utf16_col":0},"end":{"line_number":657,"utf16_col":0}}},{"name":"decltype","kind":"section_3","ident_start":25379,"ident_end":25387,"extent_start":25375,"extent_end":26085,"fully_qualified_name":"decltype","ident_utf16":{"start":{"line_number":657,"utf16_col":4},"end":{"line_number":657,"utf16_col":12}},"extent_utf16":{"start":{"line_number":657,"utf16_col":0},"end":{"line_number":684,"utf16_col":0}}},{"name":"reference","kind":"section_3","ident_start":26089,"ident_end":26098,"extent_start":26085,"extent_end":26792,"fully_qualified_name":"reference","ident_utf16":{"start":{"line_number":684,"utf16_col":4},"end":{"line_number":684,"utf16_col":13}},"extent_utf16":{"start":{"line_number":684,"utf16_col":0},"end":{"line_number":704,"utf16_col":0}}},{"name":"lvalue reference","kind":"section_4","ident_start":26105,"ident_end":26121,"extent_start":26100,"extent_end":26198,"fully_qualified_name":"lvalue reference","ident_utf16":{"start":{"line_number":686,"utf16_col":5},"end":{"line_number":686,"utf16_col":21}},"extent_utf16":{"start":{"line_number":686,"utf16_col":0},"end":{"line_number":690,"utf16_col":0}}},{"name":"rvalue reference","kind":"section_4","ident_start":26203,"ident_end":26219,"extent_start":26198,"extent_end":26673,"fully_qualified_name":"rvalue reference","ident_utf16":{"start":{"line_number":690,"utf16_col":5},"end":{"line_number":690,"utf16_col":21}},"extent_utf16":{"start":{"line_number":690,"utf16_col":0},"end":{"line_number":699,"utf16_col":0}}},{"name":"Reference Collapse","kind":"section_4","ident_start":26678,"ident_end":26696,"extent_start":26673,"extent_end":26792,"fully_qualified_name":"Reference Collapse","ident_utf16":{"start":{"line_number":699,"utf16_col":5},"end":{"line_number":699,"utf16_col":23}},"extent_utf16":{"start":{"line_number":699,"utf16_col":0},"end":{"line_number":704,"utf16_col":0}}},{"name":"Macro","kind":"section_3","ident_start":26796,"ident_end":26801,"extent_start":26792,"extent_end":27065,"fully_qualified_name":"Macro","ident_utf16":{"start":{"line_number":704,"utf16_col":4},"end":{"line_number":704,"utf16_col":9}},"extent_utf16":{"start":{"line_number":704,"utf16_col":0},"end":{"line_number":708,"utf16_col":0}}},{"name":"Member initialization list","kind":"section_3","ident_start":27069,"ident_end":27095,"extent_start":27065,"extent_end":27711,"fully_qualified_name":"Member initialization list","ident_utf16":{"start":{"line_number":708,"utf16_col":4},"end":{"line_number":708,"utf16_col":30}},"extent_utf16":{"start":{"line_number":708,"utf16_col":0},"end":{"line_number":718,"utf16_col":0}}},{"name":"initializer_list list initialization","kind":"section_3","ident_start":27715,"ident_end":27751,"extent_start":27711,"extent_end":29461,"fully_qualified_name":"initializer_list list initialization","ident_utf16":{"start":{"line_number":718,"utf16_col":4},"end":{"line_number":718,"utf16_col":40}},"extent_utf16":{"start":{"line_number":718,"utf16_col":0},"end":{"line_number":775,"utf16_col":0}}},{"name":"Object-oriented","kind":"section_3","ident_start":29465,"ident_end":29480,"extent_start":29461,"extent_end":29834,"fully_qualified_name":"Object-oriented","ident_utf16":{"start":{"line_number":775,"utf16_col":4},"end":{"line_number":775,"utf16_col":19}},"extent_utf16":{"start":{"line_number":775,"utf16_col":0},"end":{"line_number":783,"utf16_col":0}}},{"name":"Encapsulation","kind":"section_3","ident_start":29838,"ident_end":29851,"extent_start":29834,"extent_end":30364,"fully_qualified_name":"Encapsulation","ident_utf16":{"start":{"line_number":783,"utf16_col":4},"end":{"line_number":783,"utf16_col":17}},"extent_utf16":{"start":{"line_number":783,"utf16_col":0},"end":{"line_number":791,"utf16_col":0}}},{"name":"Inheritance","kind":"section_3","ident_start":30369,"ident_end":30380,"extent_start":30364,"extent_end":30448,"fully_qualified_name":"Inheritance","ident_utf16":{"start":{"line_number":791,"utf16_col":5},"end":{"line_number":791,"utf16_col":16}},"extent_utf16":{"start":{"line_number":791,"utf16_col":0},"end":{"line_number":795,"utf16_col":0}}},{"name":"Polymorphism","kind":"section_3","ident_start":30452,"ident_end":30464,"extent_start":30448,"extent_end":33045,"fully_qualified_name":"Polymorphism","ident_utf16":{"start":{"line_number":795,"utf16_col":4},"end":{"line_number":795,"utf16_col":16}},"extent_utf16":{"start":{"line_number":795,"utf16_col":0},"end":{"line_number":871,"utf16_col":0}}},{"name":"Static polymorphism (compile time / early binding)","kind":"section_4","ident_start":31139,"ident_end":31189,"extent_start":31134,"extent_end":31293,"fully_qualified_name":"Static polymorphism (compile time / early binding)","ident_utf16":{"start":{"line_number":807,"utf16_col":5},"end":{"line_number":807,"utf16_col":55}},"extent_utf16":{"start":{"line_number":807,"utf16_col":0},"end":{"line_number":820,"utf16_col":0}}},{"name":"Dynamic polymorphism (runtime / late binding)","kind":"section_4","ident_start":31298,"ident_end":31343,"extent_start":31293,"extent_end":33045,"fully_qualified_name":"Dynamic polymorphism (runtime / late binding)","ident_utf16":{"start":{"line_number":820,"utf16_col":5},"end":{"line_number":820,"utf16_col":50}},"extent_utf16":{"start":{"line_number":820,"utf16_col":0},"end":{"line_number":871,"utf16_col":0}}},{"name":"Virtual destructor","kind":"section_3","ident_start":33049,"ident_end":33067,"extent_start":33045,"extent_end":33860,"fully_qualified_name":"Virtual destructor","ident_utf16":{"start":{"line_number":871,"utf16_col":4},"end":{"line_number":871,"utf16_col":22}},"extent_utf16":{"start":{"line_number":871,"utf16_col":0},"end":{"line_number":901,"utf16_col":0}}},{"name":"Pure virtual functions","kind":"section_3","ident_start":33864,"ident_end":33886,"extent_start":33860,"extent_end":34189,"fully_qualified_name":"Pure virtual functions","ident_utf16":{"start":{"line_number":901,"utf16_col":4},"end":{"line_number":901,"utf16_col":26}},"extent_utf16":{"start":{"line_number":901,"utf16_col":0},"end":{"line_number":909,"utf16_col":0}}},{"name":"Virtual functions, pure virtual functions","kind":"section_3","ident_start":34193,"ident_end":34234,"extent_start":34189,"extent_end":35518,"fully_qualified_name":"Virtual functions, pure virtual functions","ident_utf16":{"start":{"line_number":909,"utf16_col":4},"end":{"line_number":909,"utf16_col":45}},"extent_utf16":{"start":{"line_number":909,"utf16_col":0},"end":{"line_number":919,"utf16_col":0}}},{"name":"Virtual function pointer, virtual function table","kind":"section_3","ident_start":35522,"ident_end":35570,"extent_start":35518,"extent_end":36312,"fully_qualified_name":"Virtual function pointer, virtual function table","ident_utf16":{"start":{"line_number":919,"utf16_col":4},"end":{"line_number":919,"utf16_col":52}},"extent_utf16":{"start":{"line_number":919,"utf16_col":0},"end":{"line_number":926,"utf16_col":0}}},{"name":"Virtual inheritance","kind":"section_3","ident_start":36316,"ident_end":36335,"extent_start":36312,"extent_end":37581,"fully_qualified_name":"Virtual inheritance","ident_utf16":{"start":{"line_number":926,"utf16_col":4},"end":{"line_number":926,"utf16_col":23}},"extent_utf16":{"start":{"line_number":926,"utf16_col":0},"end":{"line_number":934,"utf16_col":0}}},{"name":"Virtual inheritance, virtual functions","kind":"section_3","ident_start":37585,"ident_end":37623,"extent_start":37581,"extent_end":38182,"fully_qualified_name":"Virtual inheritance, virtual functions","ident_utf16":{"start":{"line_number":934,"utf16_col":4},"end":{"line_number":934,"utf16_col":42}},"extent_utf16":{"start":{"line_number":934,"utf16_col":0},"end":{"line_number":945,"utf16_col":0}}},{"name":"Template classes, member templates, virtual functions","kind":"section_3","ident_start":38186,"ident_end":38239,"extent_start":38182,"extent_end":38449,"fully_qualified_name":"Template classes, member templates, virtual functions","ident_utf16":{"start":{"line_number":945,"utf16_col":4},"end":{"line_number":945,"utf16_col":57}},"extent_utf16":{"start":{"line_number":945,"utf16_col":0},"end":{"line_number":950,"utf16_col":0}}},{"name":"Abstract class, interface class, aggregate class","kind":"section_3","ident_start":38453,"ident_end":38501,"extent_start":38449,"extent_end":38921,"fully_qualified_name":"Abstract class, interface class, aggregate class","ident_utf16":{"start":{"line_number":950,"utf16_col":4},"end":{"line_number":950,"utf16_col":52}},"extent_utf16":{"start":{"line_number":950,"utf16_col":0},"end":{"line_number":960,"utf16_col":0}}},{"name":"Memory allocation and management","kind":"section_3","ident_start":38925,"ident_end":38957,"extent_start":38921,"extent_end":41422,"fully_qualified_name":"Memory allocation and management","ident_utf16":{"start":{"line_number":960,"utf16_col":4},"end":{"line_number":960,"utf16_col":36}},"extent_utf16":{"start":{"line_number":960,"utf16_col":0},"end":{"line_number":1022,"utf16_col":0}}},{"name":"malloc, calloc, realloc, alloca","kind":"section_4","ident_start":38964,"ident_end":38995,"extent_start":38959,"extent_end":39948,"fully_qualified_name":"malloc, calloc, realloc, alloca","ident_utf16":{"start":{"line_number":962,"utf16_col":5},"end":{"line_number":962,"utf16_col":36}},"extent_utf16":{"start":{"line_number":962,"utf16_col":0},"end":{"line_number":969,"utf16_col":0}}},{"name":"malloc, free","kind":"section_4","ident_start":39953,"ident_end":39965,"extent_start":39948,"extent_end":40233,"fully_qualified_name":"malloc, free","ident_utf16":{"start":{"line_number":969,"utf16_col":5},"end":{"line_number":969,"utf16_col":17}},"extent_utf16":{"start":{"line_number":969,"utf16_col":0},"end":{"line_number":989,"utf16_col":0}}},{"name":"new、delete","kind":"section_4","ident_start":40238,"ident_end":40250,"extent_start":40233,"extent_end":40977,"fully_qualified_name":"new、delete","ident_utf16":{"start":{"line_number":989,"utf16_col":5},"end":{"line_number":989,"utf16_col":15}},"extent_utf16":{"start":{"line_number":989,"utf16_col":0},"end":{"line_number":1008,"utf16_col":0}}},{"name":"Positioning new","kind":"section_4","ident_start":40982,"ident_end":40997,"extent_start":40977,"extent_end":41422,"fully_qualified_name":"Positioning new","ident_utf16":{"start":{"line_number":1008,"utf16_col":5},"end":{"line_number":1008,"utf16_col":20}},"extent_utf16":{"start":{"line_number":1008,"utf16_col":0},"end":{"line_number":1022,"utf16_col":0}}},{"name":"delete this - Is it legal?","kind":"section_3","ident_start":41426,"ident_end":41452,"extent_start":41422,"extent_end":41994,"fully_qualified_name":"delete this - Is it legal?","ident_utf16":{"start":{"line_number":1022,"utf16_col":4},"end":{"line_number":1022,"utf16_col":30}},"extent_utf16":{"start":{"line_number":1022,"utf16_col":0},"end":{"line_number":1033,"utf16_col":0}}},{"name":"How to define a class that can only generate objects on the heap (on the stack)?","kind":"section_3","ident_start":41998,"ident_end":42078,"extent_start":41994,"extent_end":43073,"fully_qualified_name":"How to define a class that can only generate objects on the heap (on the stack)?","ident_utf16":{"start":{"line_number":1033,"utf16_col":4},"end":{"line_number":1033,"utf16_col":84}},"extent_utf16":{"start":{"line_number":1033,"utf16_col":0},"end":{"line_number":1049,"utf16_col":0}}},{"name":"Only on the heap","kind":"section_4","ident_start":42247,"ident_end":42263,"extent_start":42242,"extent_end":42607,"fully_qualified_name":"Only on the heap","ident_utf16":{"start":{"line_number":1037,"utf16_col":5},"end":{"line_number":1037,"utf16_col":21}},"extent_utf16":{"start":{"line_number":1037,"utf16_col":0},"end":{"line_number":1043,"utf16_col":0}}},{"name":"Only on the stack","kind":"section_4","ident_start":42612,"ident_end":42629,"extent_start":42607,"extent_end":43073,"fully_qualified_name":"Only on the stack","ident_utf16":{"start":{"line_number":1043,"utf16_col":5},"end":{"line_number":1043,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1043,"utf16_col":0},"end":{"line_number":1049,"utf16_col":0}}},{"name":"Smart pointer","kind":"section_3","ident_start":43077,"ident_end":43090,"extent_start":43073,"extent_end":45846,"fully_qualified_name":"Smart pointer","ident_utf16":{"start":{"line_number":1049,"utf16_col":4},"end":{"line_number":1049,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1049,"utf16_col":0},"end":{"line_number":1098,"utf16_col":0}}},{"name":"In the C ++ Standard Library (STL)","kind":"section_4","ident_start":43097,"ident_end":43131,"extent_start":43092,"extent_end":43168,"fully_qualified_name":"In the C ++ Standard Library (STL)","ident_utf16":{"start":{"line_number":1051,"utf16_col":5},"end":{"line_number":1051,"utf16_col":39}},"extent_utf16":{"start":{"line_number":1051,"utf16_col":0},"end":{"line_number":1055,"utf16_col":0}}},{"name":"C++ 98","kind":"section_4","ident_start":43173,"ident_end":43179,"extent_start":43168,"extent_end":43249,"fully_qualified_name":"C++ 98","ident_utf16":{"start":{"line_number":1055,"utf16_col":5},"end":{"line_number":1055,"utf16_col":11}},"extent_utf16":{"start":{"line_number":1055,"utf16_col":0},"end":{"line_number":1061,"utf16_col":0}}},{"name":"C++ 11","kind":"section_4","ident_start":43254,"ident_end":43260,"extent_start":43249,"extent_end":45846,"fully_qualified_name":"C++ 11","ident_utf16":{"start":{"line_number":1061,"utf16_col":5},"end":{"line_number":1061,"utf16_col":11}},"extent_utf16":{"start":{"line_number":1061,"utf16_col":0},"end":{"line_number":1098,"utf16_col":0}}},{"name":"shared_ptr","kind":"section_5","ident_start":44007,"ident_end":44017,"extent_start":44001,"extent_end":44387,"fully_qualified_name":"shared_ptr","ident_utf16":{"start":{"line_number":1071,"utf16_col":6},"end":{"line_number":1071,"utf16_col":16}},"extent_utf16":{"start":{"line_number":1071,"utf16_col":0},"end":{"line_number":1077,"utf16_col":0}}},{"name":"weak_ptr","kind":"section_5","ident_start":44393,"ident_end":44401,"extent_start":44387,"extent_end":44846,"fully_qualified_name":"weak_ptr","ident_utf16":{"start":{"line_number":1077,"utf16_col":6},"end":{"line_number":1077,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1077,"utf16_col":0},"end":{"line_number":1083,"utf16_col":0}}},{"name":"unique_ptr","kind":"section_5","ident_start":44852,"ident_end":44862,"extent_start":44846,"extent_end":45364,"fully_qualified_name":"unique_ptr","ident_utf16":{"start":{"line_number":1083,"utf16_col":6},"end":{"line_number":1083,"utf16_col":16}},"extent_utf16":{"start":{"line_number":1083,"utf16_col":0},"end":{"line_number":1089,"utf16_col":0}}},{"name":"auto_ptr","kind":"section_5","ident_start":45370,"ident_end":45378,"extent_start":45364,"extent_end":45518,"fully_qualified_name":"auto_ptr","ident_utf16":{"start":{"line_number":1089,"utf16_col":6},"end":{"line_number":1089,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1089,"utf16_col":0},"end":{"line_number":1093,"utf16_col":0}}},{"name":"auto_ptr compared to unique_ptr","kind":"section_5","ident_start":45524,"ident_end":45555,"extent_start":45518,"extent_end":45846,"fully_qualified_name":"auto_ptr compared to unique_ptr","ident_utf16":{"start":{"line_number":1093,"utf16_col":6},"end":{"line_number":1093,"utf16_col":37}},"extent_utf16":{"start":{"line_number":1093,"utf16_col":0},"end":{"line_number":1098,"utf16_col":0}}},{"name":"Casting Operator","kind":"section_3","ident_start":45850,"ident_end":45866,"extent_start":45846,"extent_end":47930,"fully_qualified_name":"Casting Operator","ident_utf16":{"start":{"line_number":1098,"utf16_col":4},"end":{"line_number":1098,"utf16_col":20}},"extent_utf16":{"start":{"line_number":1098,"utf16_col":0},"end":{"line_number":1147,"utf16_col":0}}},{"name":"static_cast","kind":"section_4","ident_start":45957,"ident_end":45968,"extent_start":45952,"extent_end":46490,"fully_qualified_name":"static_cast","ident_utf16":{"start":{"line_number":1102,"utf16_col":5},"end":{"line_number":1102,"utf16_col":16}},"extent_utf16":{"start":{"line_number":1102,"utf16_col":0},"end":{"line_number":1111,"utf16_col":0}}},{"name":"dynamic_cast","kind":"section_4","ident_start":46495,"ident_end":46507,"extent_start":46490,"extent_end":46821,"fully_qualified_name":"dynamic_cast","ident_utf16":{"start":{"line_number":1111,"utf16_col":5},"end":{"line_number":1111,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1111,"utf16_col":0},"end":{"line_number":1119,"utf16_col":0}}},{"name":"const_cast","kind":"section_4","ident_start":46826,"ident_end":46836,"extent_start":46821,"extent_end":46936,"fully_qualified_name":"const_cast","ident_utf16":{"start":{"line_number":1119,"utf16_col":5},"end":{"line_number":1119,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1119,"utf16_col":0},"end":{"line_number":1123,"utf16_col":0}}},{"name":"reinterpret_cast","kind":"section_4","ident_start":46941,"ident_end":46957,"extent_start":46936,"extent_end":47649,"fully_qualified_name":"reinterpret_cast","ident_utf16":{"start":{"line_number":1123,"utf16_col":5},"end":{"line_number":1123,"utf16_col":21}},"extent_utf16":{"start":{"line_number":1123,"utf16_col":0},"end":{"line_number":1132,"utf16_col":0}}},{"name":"bad_cast","kind":"section_4","ident_start":47654,"ident_end":47662,"extent_start":47649,"extent_end":47930,"fully_qualified_name":"bad_cast","ident_utf16":{"start":{"line_number":1132,"utf16_col":5},"end":{"line_number":1132,"utf16_col":13}},"extent_utf16":{"start":{"line_number":1132,"utf16_col":0},"end":{"line_number":1147,"utf16_col":0}}},{"name":"Runtime Type Information (RTTI)","kind":"section_3","ident_start":47934,"ident_end":47965,"extent_start":47930,"extent_end":50184,"fully_qualified_name":"Runtime Type Information (RTTI)","ident_utf16":{"start":{"line_number":1147,"utf16_col":4},"end":{"line_number":1147,"utf16_col":35}},"extent_utf16":{"start":{"line_number":1147,"utf16_col":0},"end":{"line_number":1231,"utf16_col":0}}},{"name":"dynamic_cast","kind":"section_4","ident_start":47972,"ident_end":47984,"extent_start":47967,"extent_end":48022,"fully_qualified_name":"dynamic_cast","ident_utf16":{"start":{"line_number":1149,"utf16_col":5},"end":{"line_number":1149,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1149,"utf16_col":0},"end":{"line_number":1153,"utf16_col":0}}},{"name":"typeid","kind":"section_4","ident_start":48027,"ident_end":48033,"extent_start":48022,"extent_end":48352,"fully_qualified_name":"typeid","ident_utf16":{"start":{"line_number":1153,"utf16_col":5},"end":{"line_number":1153,"utf16_col":11}},"extent_utf16":{"start":{"line_number":1153,"utf16_col":0},"end":{"line_number":1160,"utf16_col":0}}},{"name":"type_info","kind":"section_4","ident_start":48357,"ident_end":48366,"extent_start":48352,"extent_end":50184,"fully_qualified_name":"type_info","ident_utf16":{"start":{"line_number":1160,"utf16_col":5},"end":{"line_number":1160,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1160,"utf16_col":0},"end":{"line_number":1231,"utf16_col":0}}},{"name":"⭐️ Effective","kind":"section_2","ident_start":50187,"ident_end":50203,"extent_start":50184,"extent_end":66446,"fully_qualified_name":"⭐️ Effective","ident_utf16":{"start":{"line_number":1231,"utf16_col":3},"end":{"line_number":1231,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1231,"utf16_col":0},"end":{"line_number":1317,"utf16_col":0}}},{"name":"Effective C++","kind":"section_3","ident_start":50209,"ident_end":50222,"extent_start":50205,"extent_end":61211,"fully_qualified_name":"Effective C++","ident_utf16":{"start":{"line_number":1233,"utf16_col":4},"end":{"line_number":1233,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1233,"utf16_col":0},"end":{"line_number":1284,"utf16_col":0}}},{"name":"More Effective c++","kind":"section_3","ident_start":61215,"ident_end":61233,"extent_start":61211,"extent_end":66025,"fully_qualified_name":"More Effective c++","ident_utf16":{"start":{"line_number":1284,"utf16_col":4},"end":{"line_number":1284,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1284,"utf16_col":0},"end":{"line_number":1305,"utf16_col":0}}},{"name":"Google C ++ Style Guide","kind":"section_3","ident_start":66029,"ident_end":66052,"extent_start":66025,"extent_end":66260,"fully_qualified_name":"Google C ++ Style Guide","ident_utf16":{"start":{"line_number":1305,"utf16_col":4},"end":{"line_number":1305,"utf16_col":27}},"extent_utf16":{"start":{"line_number":1305,"utf16_col":0},"end":{"line_number":1310,"utf16_col":0}}},{"name":"Other","kind":"section_3","ident_start":66264,"ident_end":66269,"extent_start":66260,"extent_end":66446,"fully_qualified_name":"Other","ident_utf16":{"start":{"line_number":1310,"utf16_col":4},"end":{"line_number":1310,"utf16_col":9}},"extent_utf16":{"start":{"line_number":1310,"utf16_col":0},"end":{"line_number":1317,"utf16_col":0}}},{"name":"📦 STL","kind":"section_2","ident_start":66449,"ident_end":66457,"extent_start":66446,"extent_end":70253,"fully_qualified_name":"📦 STL","ident_utf16":{"start":{"line_number":1317,"utf16_col":3},"end":{"line_number":1317,"utf16_col":9}},"extent_utf16":{"start":{"line_number":1317,"utf16_col":0},"end":{"line_number":1354,"utf16_col":0}}},{"name":"STL index","kind":"section_3","ident_start":66463,"ident_end":66472,"extent_start":66459,"extent_end":66555,"fully_qualified_name":"STL index","ident_utf16":{"start":{"line_number":1319,"utf16_col":4},"end":{"line_number":1319,"utf16_col":13}},"extent_utf16":{"start":{"line_number":1319,"utf16_col":0},"end":{"line_number":1323,"utf16_col":0}}},{"name":"STL container","kind":"section_3","ident_start":66559,"ident_end":66572,"extent_start":66555,"extent_end":69812,"fully_qualified_name":"STL container","ident_utf16":{"start":{"line_number":1323,"utf16_col":4},"end":{"line_number":1323,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1323,"utf16_col":0},"end":{"line_number":1345,"utf16_col":0}}},{"name":"STL Algorithm","kind":"section_3","ident_start":69816,"ident_end":69829,"extent_start":69812,"extent_end":70253,"fully_qualified_name":"STL Algorithm","ident_utf16":{"start":{"line_number":1345,"utf16_col":4},"end":{"line_number":1345,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1345,"utf16_col":0},"end":{"line_number":1354,"utf16_col":0}}},{"name":"〽️ Data Structure","kind":"section_2","ident_start":70256,"ident_end":70277,"extent_start":70253,"extent_end":81608,"fully_qualified_name":"〽️ Data Structure","ident_utf16":{"start":{"line_number":1354,"utf16_col":3},"end":{"line_number":1354,"utf16_col":20}},"extent_utf16":{"start":{"line_number":1354,"utf16_col":0},"end":{"line_number":1748,"utf16_col":0}}},{"name":"Sequence structure","kind":"section_3","ident_start":70283,"ident_end":70301,"extent_start":70279,"extent_end":71396,"fully_qualified_name":"Sequence structure","ident_utf16":{"start":{"line_number":1356,"utf16_col":4},"end":{"line_number":1356,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1356,"utf16_col":0},"end":{"line_number":1422,"utf16_col":0}}},{"name":"Sequential stack(Sequence Stack)","kind":"section_4","ident_start":70308,"ident_end":70344,"extent_start":70303,"extent_end":70612,"fully_qualified_name":"Sequential stack(Sequence Stack)","ident_utf16":{"start":{"line_number":1358,"utf16_col":5},"end":{"line_number":1358,"utf16_col":37}},"extent_utf16":{"start":{"line_number":1358,"utf16_col":0},"end":{"line_number":1375,"utf16_col":0}}},{"name":"queue(Sequence Queue)","kind":"section_4","ident_start":70617,"ident_end":70642,"extent_start":70612,"extent_end":71093,"fully_qualified_name":"queue(Sequence Queue)","ident_utf16":{"start":{"line_number":1375,"utf16_col":5},"end":{"line_number":1375,"utf16_col":26}},"extent_utf16":{"start":{"line_number":1375,"utf16_col":0},"end":{"line_number":1404,"utf16_col":0}}},{"name":"Acyclic queue","kind":"section_5","ident_start":70766,"ident_end":70779,"extent_start":70760,"extent_end":70905,"fully_qualified_name":"Acyclic queue","ident_utf16":{"start":{"line_number":1388,"utf16_col":6},"end":{"line_number":1388,"utf16_col":19}},"extent_utf16":{"start":{"line_number":1388,"utf16_col":0},"end":{"line_number":1396,"utf16_col":0}}},{"name":"Circular queue","kind":"section_5","ident_start":70911,"ident_end":70925,"extent_start":70905,"extent_end":71093,"fully_qualified_name":"Circular queue","ident_utf16":{"start":{"line_number":1396,"utf16_col":6},"end":{"line_number":1396,"utf16_col":20}},"extent_utf16":{"start":{"line_number":1396,"utf16_col":0},"end":{"line_number":1404,"utf16_col":0}}},{"name":"Sequence table(Sequence List)","kind":"section_4","ident_start":71098,"ident_end":71131,"extent_start":71093,"extent_end":71396,"fully_qualified_name":"Sequence table(Sequence List)","ident_utf16":{"start":{"line_number":1404,"utf16_col":5},"end":{"line_number":1404,"utf16_col":34}},"extent_utf16":{"start":{"line_number":1404,"utf16_col":0},"end":{"line_number":1422,"utf16_col":0}}},{"name":"Chain structure","kind":"section_3","ident_start":71400,"ident_end":71415,"extent_start":71396,"extent_end":72309,"fully_qualified_name":"Chain structure","ident_utf16":{"start":{"line_number":1422,"utf16_col":4},"end":{"line_number":1422,"utf16_col":19}},"extent_utf16":{"start":{"line_number":1422,"utf16_col":0},"end":{"line_number":1463,"utf16_col":0}}},{"name":"Chain queue(Link Queue)","kind":"section_4","ident_start":71653,"ident_end":71680,"extent_start":71648,"extent_end":71788,"fully_qualified_name":"Chain queue(Link Queue)","ident_utf16":{"start":{"line_number":1437,"utf16_col":5},"end":{"line_number":1437,"utf16_col":28}},"extent_utf16":{"start":{"line_number":1437,"utf16_col":0},"end":{"line_number":1443,"utf16_col":0}}},{"name":"Chained representation of a linear list","kind":"section_4","ident_start":71793,"ident_end":71832,"extent_start":71788,"extent_end":72309,"fully_qualified_name":"Chained representation of a linear list","ident_utf16":{"start":{"line_number":1443,"utf16_col":5},"end":{"line_number":1443,"utf16_col":44}},"extent_utf16":{"start":{"line_number":1443,"utf16_col":0},"end":{"line_number":1463,"utf16_col":0}}},{"name":"Singly-Linked list(Link List)","kind":"section_5","ident_start":71840,"ident_end":71873,"extent_start":71834,"extent_end":71987,"fully_qualified_name":"Singly-Linked list(Link List)","ident_utf16":{"start":{"line_number":1445,"utf16_col":6},"end":{"line_number":1445,"utf16_col":35}},"extent_utf16":{"start":{"line_number":1445,"utf16_col":0},"end":{"line_number":1451,"utf16_col":0}}},{"name":"Doubly linked list(Du-Link-List)","kind":"section_5","ident_start":71993,"ident_end":72029,"extent_start":71987,"extent_end":72145,"fully_qualified_name":"Doubly linked list(Du-Link-List)","ident_utf16":{"start":{"line_number":1451,"utf16_col":6},"end":{"line_number":1451,"utf16_col":38}},"extent_utf16":{"start":{"line_number":1451,"utf16_col":0},"end":{"line_number":1457,"utf16_col":0}}},{"name":"Circular linked list(Cir-Link-List)","kind":"section_5","ident_start":72151,"ident_end":72190,"extent_start":72145,"extent_end":72309,"fully_qualified_name":"Circular linked list(Cir-Link-List)","ident_utf16":{"start":{"line_number":1457,"utf16_col":6},"end":{"line_number":1457,"utf16_col":41}},"extent_utf16":{"start":{"line_number":1457,"utf16_col":0},"end":{"line_number":1463,"utf16_col":0}}},{"name":"Hash table","kind":"section_3","ident_start":72313,"ident_end":72323,"extent_start":72309,"extent_end":73306,"fully_qualified_name":"Hash table","ident_utf16":{"start":{"line_number":1463,"utf16_col":4},"end":{"line_number":1463,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1463,"utf16_col":0},"end":{"line_number":1508,"utf16_col":0}}},{"name":"Concept","kind":"section_4","ident_start":72376,"ident_end":72383,"extent_start":72371,"extent_end":72431,"fully_qualified_name":"Concept","ident_utf16":{"start":{"line_number":1467,"utf16_col":5},"end":{"line_number":1467,"utf16_col":12}},"extent_utf16":{"start":{"line_number":1467,"utf16_col":0},"end":{"line_number":1471,"utf16_col":0}}},{"name":"Construction method","kind":"section_4","ident_start":72436,"ident_end":72455,"extent_start":72431,"extent_end":72568,"fully_qualified_name":"Construction method","ident_utf16":{"start":{"line_number":1471,"utf16_col":5},"end":{"line_number":1471,"utf16_col":24}},"extent_utf16":{"start":{"line_number":1471,"utf16_col":0},"end":{"line_number":1479,"utf16_col":0}}},{"name":"Collision resolution method","kind":"section_4","ident_start":72573,"ident_end":72600,"extent_start":72568,"extent_end":72953,"fully_qualified_name":"Collision resolution method","ident_utf16":{"start":{"line_number":1479,"utf16_col":5},"end":{"line_number":1479,"utf16_col":32}},"extent_utf16":{"start":{"line_number":1479,"utf16_col":0},"end":{"line_number":1487,"utf16_col":0}}},{"name":"Hash table data structure for linear probing","kind":"section_4","ident_start":72958,"ident_end":73002,"extent_start":72953,"extent_end":73306,"fully_qualified_name":"Hash table data structure for linear probing","ident_utf16":{"start":{"line_number":1487,"utf16_col":5},"end":{"line_number":1487,"utf16_col":49}},"extent_utf16":{"start":{"line_number":1487,"utf16_col":0},"end":{"line_number":1508,"utf16_col":0}}},{"name":"Recursion","kind":"section_3","ident_start":73310,"ident_end":73319,"extent_start":73306,"extent_end":75443,"fully_qualified_name":"Recursion","ident_utf16":{"start":{"line_number":1508,"utf16_col":4},"end":{"line_number":1508,"utf16_col":13}},"extent_utf16":{"start":{"line_number":1508,"utf16_col":0},"end":{"line_number":1579,"utf16_col":0}}},{"name":"Concept","kind":"section_4","ident_start":73326,"ident_end":73333,"extent_start":73321,"extent_end":73381,"fully_qualified_name":"Concept","ident_utf16":{"start":{"line_number":1510,"utf16_col":5},"end":{"line_number":1510,"utf16_col":12}},"extent_utf16":{"start":{"line_number":1510,"utf16_col":0},"end":{"line_number":1514,"utf16_col":0}}},{"name":"Recursion and Divide","kind":"section_4","ident_start":73386,"ident_end":73406,"extent_start":73381,"extent_end":73572,"fully_qualified_name":"Recursion and Divide","ident_utf16":{"start":{"line_number":1514,"utf16_col":5},"end":{"line_number":1514,"utf16_col":25}},"extent_utf16":{"start":{"line_number":1514,"utf16_col":0},"end":{"line_number":1523,"utf16_col":0}}},{"name":"Recursion and Iteration","kind":"section_4","ident_start":73577,"ident_end":73600,"extent_start":73572,"extent_end":73741,"fully_qualified_name":"Recursion and Iteration","ident_utf16":{"start":{"line_number":1523,"utf16_col":5},"end":{"line_number":1523,"utf16_col":28}},"extent_utf16":{"start":{"line_number":1523,"utf16_col":0},"end":{"line_number":1529,"utf16_col":0}}},{"name":"Generalized table","kind":"section_4","ident_start":73746,"ident_end":73763,"extent_start":73741,"extent_end":75443,"fully_qualified_name":"Generalized table","ident_utf16":{"start":{"line_number":1529,"utf16_col":5},"end":{"line_number":1529,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1529,"utf16_col":0},"end":{"line_number":1579,"utf16_col":0}}},{"name":"Head and tail linked list storage representation","kind":"section_5","ident_start":73771,"ident_end":73819,"extent_start":73765,"extent_end":74659,"fully_qualified_name":"Head and tail linked list storage representation","ident_utf16":{"start":{"line_number":1531,"utf16_col":6},"end":{"line_number":1531,"utf16_col":54}},"extent_utf16":{"start":{"line_number":1531,"utf16_col":0},"end":{"line_number":1556,"utf16_col":0}}},{"name":"Extended linear linked list storage representation","kind":"section_5","ident_start":74665,"ident_end":74715,"extent_start":74659,"extent_end":75443,"fully_qualified_name":"Extended linear linked list storage representation","ident_utf16":{"start":{"line_number":1556,"utf16_col":6},"end":{"line_number":1556,"utf16_col":56}},"extent_utf16":{"start":{"line_number":1556,"utf16_col":0},"end":{"line_number":1579,"utf16_col":0}}},{"name":"Binary tree","kind":"section_3","ident_start":75447,"ident_end":75458,"extent_start":75443,"extent_end":77449,"fully_qualified_name":"Binary tree","ident_utf16":{"start":{"line_number":1579,"utf16_col":4},"end":{"line_number":1579,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1579,"utf16_col":0},"end":{"line_number":1639,"utf16_col":0}}},{"name":"properties","kind":"section_4","ident_start":75513,"ident_end":75523,"extent_start":75508,"extent_end":76228,"fully_qualified_name":"properties","ident_utf16":{"start":{"line_number":1583,"utf16_col":5},"end":{"line_number":1583,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1583,"utf16_col":0},"end":{"line_number":1594,"utf16_col":0}}},{"name":"Storage structure","kind":"section_4","ident_start":76233,"ident_end":76250,"extent_start":76228,"extent_end":76695,"fully_qualified_name":"Storage structure","ident_utf16":{"start":{"line_number":1594,"utf16_col":5},"end":{"line_number":1594,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1594,"utf16_col":0},"end":{"line_number":1618,"utf16_col":0}}},{"name":"Sequential storage","kind":"section_5","ident_start":76399,"ident_end":76417,"extent_start":76393,"extent_end":76548,"fully_qualified_name":"Sequential storage","ident_utf16":{"start":{"line_number":1606,"utf16_col":6},"end":{"line_number":1606,"utf16_col":24}},"extent_utf16":{"start":{"line_number":1606,"utf16_col":0},"end":{"line_number":1612,"utf16_col":0}}},{"name":"Chained storage","kind":"section_5","ident_start":76554,"ident_end":76569,"extent_start":76548,"extent_end":76695,"fully_qualified_name":"Chained storage","ident_utf16":{"start":{"line_number":1612,"utf16_col":6},"end":{"line_number":1612,"utf16_col":21}},"extent_utf16":{"start":{"line_number":1612,"utf16_col":0},"end":{"line_number":1618,"utf16_col":0}}},{"name":"Traversal","kind":"section_4","ident_start":76700,"ident_end":76709,"extent_start":76695,"extent_end":76803,"fully_qualified_name":"Traversal","ident_utf16":{"start":{"line_number":1618,"utf16_col":5},"end":{"line_number":1618,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1618,"utf16_col":0},"end":{"line_number":1625,"utf16_col":0}}},{"name":"Categories","kind":"section_4","ident_start":76808,"ident_end":76818,"extent_start":76803,"extent_end":77449,"fully_qualified_name":"Categories","ident_utf16":{"start":{"line_number":1625,"utf16_col":5},"end":{"line_number":1625,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1625,"utf16_col":0},"end":{"line_number":1639,"utf16_col":0}}},{"name":"Other trees and forests","kind":"section_3","ident_start":77453,"ident_end":77476,"extent_start":77449,"extent_end":81608,"fully_qualified_name":"Other trees and forests","ident_utf16":{"start":{"line_number":1639,"utf16_col":4},"end":{"line_number":1639,"utf16_col":27}},"extent_utf16":{"start":{"line_number":1639,"utf16_col":0},"end":{"line_number":1748,"utf16_col":0}}},{"name":"The storage structure of the tree","kind":"section_4","ident_start":77483,"ident_end":77516,"extent_start":77478,"extent_end":77584,"fully_qualified_name":"The storage structure of the tree","ident_utf16":{"start":{"line_number":1641,"utf16_col":5},"end":{"line_number":1641,"utf16_col":38}},"extent_utf16":{"start":{"line_number":1641,"utf16_col":0},"end":{"line_number":1647,"utf16_col":0}}},{"name":"And check","kind":"section_4","ident_start":77589,"ident_end":77598,"extent_start":77584,"extent_end":77649,"fully_qualified_name":"And check","ident_utf16":{"start":{"line_number":1647,"utf16_col":5},"end":{"line_number":1647,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1647,"utf16_col":0},"end":{"line_number":1651,"utf16_col":0}}},{"name":"Balanced Binary Tree (AVL Tree)","kind":"section_4","ident_start":77654,"ident_end":77685,"extent_start":77649,"extent_end":78530,"fully_qualified_name":"Balanced Binary Tree (AVL Tree)","ident_utf16":{"start":{"line_number":1651,"utf16_col":5},"end":{"line_number":1651,"utf16_col":36}},"extent_utf16":{"start":{"line_number":1651,"utf16_col":0},"end":{"line_number":1674,"utf16_col":0}}},{"name":"nature","kind":"section_5","ident_start":77693,"ident_end":77699,"extent_start":77687,"extent_end":78200,"fully_qualified_name":"nature","ident_utf16":{"start":{"line_number":1653,"utf16_col":6},"end":{"line_number":1653,"utf16_col":12}},"extent_utf16":{"start":{"line_number":1653,"utf16_col":0},"end":{"line_number":1663,"utf16_col":0}}},{"name":"Minimal Imbalance Tree","kind":"section_5","ident_start":78206,"ident_end":78228,"extent_start":78200,"extent_end":78530,"fully_qualified_name":"Minimal Imbalance Tree","ident_utf16":{"start":{"line_number":1663,"utf16_col":6},"end":{"line_number":1663,"utf16_col":28}},"extent_utf16":{"start":{"line_number":1663,"utf16_col":0},"end":{"line_number":1674,"utf16_col":0}}},{"name":"Red black tree","kind":"section_4","ident_start":78535,"ident_end":78549,"extent_start":78530,"extent_end":79474,"fully_qualified_name":"Red black tree","ident_utf16":{"start":{"line_number":1674,"utf16_col":5},"end":{"line_number":1674,"utf16_col":19}},"extent_utf16":{"start":{"line_number":1674,"utf16_col":0},"end":{"line_number":1701,"utf16_col":0}}},{"name":"What are the characteristics of red-black trees?","kind":"section_5","ident_start":78609,"ident_end":78657,"extent_start":78603,"extent_end":79071,"fully_qualified_name":"What are the characteristics of red-black trees?","ident_utf16":{"start":{"line_number":1678,"utf16_col":6},"end":{"line_number":1678,"utf16_col":54}},"extent_utf16":{"start":{"line_number":1678,"utf16_col":0},"end":{"line_number":1686,"utf16_col":0}}},{"name":"Adjustment","kind":"section_5","ident_start":79077,"ident_end":79087,"extent_start":79071,"extent_end":79120,"fully_qualified_name":"Adjustment","ident_utf16":{"start":{"line_number":1686,"utf16_col":6},"end":{"line_number":1686,"utf16_col":16}},"extent_utf16":{"start":{"line_number":1686,"utf16_col":0},"end":{"line_number":1692,"utf16_col":0}}},{"name":"Application","kind":"section_5","ident_start":79126,"ident_end":79137,"extent_start":79120,"extent_end":79186,"fully_qualified_name":"Application","ident_utf16":{"start":{"line_number":1692,"utf16_col":6},"end":{"line_number":1692,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1692,"utf16_col":0},"end":{"line_number":1696,"utf16_col":0}}},{"name":"What is the difference between red and black trees, B trees, and B + trees?","kind":"section_5","ident_start":79192,"ident_end":79267,"extent_start":79186,"extent_end":79474,"fully_qualified_name":"What is the difference between red and black trees, B trees, and B + trees?","ident_utf16":{"start":{"line_number":1696,"utf16_col":6},"end":{"line_number":1696,"utf16_col":81}},"extent_utf16":{"start":{"line_number":1696,"utf16_col":0},"end":{"line_number":1701,"utf16_col":0}}},{"name":"B-tree, B + -tree","kind":"section_4","ident_start":79479,"ident_end":79496,"extent_start":79474,"extent_end":81016,"fully_qualified_name":"B-tree, B + -tree","ident_utf16":{"start":{"line_number":1701,"utf16_col":5},"end":{"line_number":1701,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1701,"utf16_col":0},"end":{"line_number":1732,"utf16_col":0}}},{"name":"Features","kind":"section_5","ident_start":79606,"ident_end":79614,"extent_start":79600,"extent_end":79762,"fully_qualified_name":"Features","ident_utf16":{"start":{"line_number":1707,"utf16_col":6},"end":{"line_number":1707,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1707,"utf16_col":0},"end":{"line_number":1712,"utf16_col":0}}},{"name":"Application","kind":"section_5","ident_start":79768,"ident_end":79779,"extent_start":79762,"extent_end":79869,"fully_qualified_name":"Application","ident_utf16":{"start":{"line_number":1712,"utf16_col":6},"end":{"line_number":1712,"utf16_col":17}},"extent_utf16":{"start":{"line_number":1712,"utf16_col":0},"end":{"line_number":1716,"utf16_col":0}}},{"name":"the difference","kind":"section_5","ident_start":79875,"ident_end":79889,"extent_start":79869,"extent_end":80186,"fully_qualified_name":"the difference","ident_utf16":{"start":{"line_number":1716,"utf16_col":6},"end":{"line_number":1716,"utf16_col":20}},"extent_utf16":{"start":{"line_number":1716,"utf16_col":0},"end":{"line_number":1721,"utf16_col":0}}},{"name":"Advantages of B-tree","kind":"section_5","ident_start":80192,"ident_end":80212,"extent_start":80186,"extent_end":80325,"fully_qualified_name":"Advantages of B-tree","ident_utf16":{"start":{"line_number":1721,"utf16_col":6},"end":{"line_number":1721,"utf16_col":26}},"extent_utf16":{"start":{"line_number":1721,"utf16_col":0},"end":{"line_number":1725,"utf16_col":0}}},{"name":"Advantages of B + trees","kind":"section_5","ident_start":80331,"ident_end":80354,"extent_start":80325,"extent_end":81016,"fully_qualified_name":"Advantages of B + trees","ident_utf16":{"start":{"line_number":1725,"utf16_col":6},"end":{"line_number":1725,"utf16_col":29}},"extent_utf16":{"start":{"line_number":1725,"utf16_col":0},"end":{"line_number":1732,"utf16_col":0}}},{"name":"Octree","kind":"section_4","ident_start":81021,"ident_end":81027,"extent_start":81016,"extent_end":81608,"fully_qualified_name":"Octree","ident_utf16":{"start":{"line_number":1732,"utf16_col":5},"end":{"line_number":1732,"utf16_col":11}},"extent_utf16":{"start":{"line_number":1732,"utf16_col":0},"end":{"line_number":1748,"utf16_col":0}}},{"name":"Purpose","kind":"section_5","ident_start":81534,"ident_end":81541,"extent_start":81528,"extent_end":81608,"fully_qualified_name":"Purpose","ident_utf16":{"start":{"line_number":1741,"utf16_col":6},"end":{"line_number":1741,"utf16_col":13}},"extent_utf16":{"start":{"line_number":1741,"utf16_col":0},"end":{"line_number":1748,"utf16_col":0}}},{"name":"⚡️ Algorithm","kind":"section_2","ident_start":81611,"ident_end":81627,"extent_start":81608,"extent_end":85626,"fully_qualified_name":"⚡️ Algorithm","ident_utf16":{"start":{"line_number":1748,"utf16_col":3},"end":{"line_number":1748,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1748,"utf16_col":0},"end":{"line_number":1802,"utf16_col":0}}},{"name":"Sort","kind":"section_3","ident_start":81633,"ident_end":81637,"extent_start":81629,"extent_end":82974,"fully_qualified_name":"Sort","ident_utf16":{"start":{"line_number":1750,"utf16_col":4},"end":{"line_number":1750,"utf16_col":8}},"extent_utf16":{"start":{"line_number":1750,"utf16_col":0},"end":{"line_number":1771,"utf16_col":0}}},{"name":"Find","kind":"section_3","ident_start":82978,"ident_end":82982,"extent_start":82974,"extent_end":83784,"fully_qualified_name":"Find","ident_utf16":{"start":{"line_number":1771,"utf16_col":4},"end":{"line_number":1771,"utf16_col":8}},"extent_utf16":{"start":{"line_number":1771,"utf16_col":0},"end":{"line_number":1785,"utf16_col":0}}},{"name":"Graph search algorithm","kind":"section_3","ident_start":83788,"ident_end":83810,"extent_start":83784,"extent_end":84391,"fully_qualified_name":"Graph search algorithm","ident_utf16":{"start":{"line_number":1785,"utf16_col":4},"end":{"line_number":1785,"utf16_col":26}},"extent_utf16":{"start":{"line_number":1785,"utf16_col":0},"end":{"line_number":1792,"utf16_col":0}}},{"name":"Other algorithms","kind":"section_3","ident_start":84395,"ident_end":84411,"extent_start":84391,"extent_end":85626,"fully_qualified_name":"Other algorithms","ident_utf16":{"start":{"line_number":1792,"utf16_col":4},"end":{"line_number":1792,"utf16_col":20}},"extent_utf16":{"start":{"line_number":1792,"utf16_col":0},"end":{"line_number":1802,"utf16_col":0}}},{"name":"❓ Problems","kind":"section_2","ident_start":85629,"ident_end":85641,"extent_start":85626,"extent_end":86661,"fully_qualified_name":"❓ Problems","ident_utf16":{"start":{"line_number":1802,"utf16_col":3},"end":{"line_number":1802,"utf16_col":13}},"extent_utf16":{"start":{"line_number":1802,"utf16_col":0},"end":{"line_number":1833,"utf16_col":0}}},{"name":"Single Problem","kind":"section_3","ident_start":85647,"ident_end":85661,"extent_start":85643,"extent_end":85968,"fully_qualified_name":"Single Problem","ident_utf16":{"start":{"line_number":1804,"utf16_col":4},"end":{"line_number":1804,"utf16_col":18}},"extent_utf16":{"start":{"line_number":1804,"utf16_col":0},"end":{"line_number":1812,"utf16_col":0}}},{"name":"Leetcode Problems","kind":"section_3","ident_start":85972,"ident_end":85989,"extent_start":85968,"extent_end":86116,"fully_qualified_name":"Leetcode Problems","ident_utf16":{"start":{"line_number":1812,"utf16_col":4},"end":{"line_number":1812,"utf16_col":21}},"extent_utf16":{"start":{"line_number":1812,"utf16_col":0},"end":{"line_number":1817,"utf16_col":0}}},{"name":"Sword Finger Offer","kind":"section_3","ident_start":86120,"ident_end":86138,"extent_start":86116,"extent_end":86323,"fully_qualified_name":"Sword Finger Offer","ident_utf16":{"start":{"line_number":1817,"utf16_col":4},"end":{"line_number":1817,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1817,"utf16_col":0},"end":{"line_number":1822,"utf16_col":0}}},{"name":"Cracking the Coding Interview (Programmer Interview Gold)","kind":"section_3","ident_start":86327,"ident_end":86384,"extent_start":86323,"extent_end":86554,"fully_qualified_name":"Cracking the Coding Interview (Programmer Interview Gold)","ident_utf16":{"start":{"line_number":1822,"utf16_col":4},"end":{"line_number":1822,"utf16_col":61}},"extent_utf16":{"start":{"line_number":1822,"utf16_col":0},"end":{"line_number":1827,"utf16_col":0}}},{"name":"Niu Ke","kind":"section_3","ident_start":86558,"ident_end":86564,"extent_start":86554,"extent_end":86661,"fully_qualified_name":"Niu Ke","ident_utf16":{"start":{"line_number":1827,"utf16_col":4},"end":{"line_number":1827,"utf16_col":10}},"extent_utf16":{"start":{"line_number":1827,"utf16_col":0},"end":{"line_number":1833,"utf16_col":0}}},{"name":"💻 Operating system","kind":"section_2","ident_start":86664,"ident_end":86685,"extent_start":86661,"extent_end":98902,"fully_qualified_name":"💻 Operating system","ident_utf16":{"start":{"line_number":1833,"utf16_col":3},"end":{"line_number":1833,"utf16_col":22}},"extent_utf16":{"start":{"line_number":1833,"utf16_col":0},"end":{"line_number":2067,"utf16_col":0}}},{"name":"Processes and threads","kind":"section_3","ident_start":86691,"ident_end":86712,"extent_start":86687,"extent_end":93745,"fully_qualified_name":"Processes and threads","ident_utf16":{"start":{"line_number":1835,"utf16_col":4},"end":{"line_number":1835,"utf16_col":25}},"extent_utf16":{"start":{"line_number":1835,"utf16_col":0},"end":{"line_number":1935,"utf16_col":0}}},{"name":"Communication between processes and advantages and disadvantages","kind":"section_4","ident_start":86952,"ident_end":87016,"extent_start":86947,"extent_end":89758,"fully_qualified_name":"Communication between processes and advantages and disadvantages","ident_utf16":{"start":{"line_number":1844,"utf16_col":5},"end":{"line_number":1844,"utf16_col":69}},"extent_utf16":{"start":{"line_number":1844,"utf16_col":0},"end":{"line_number":1878,"utf16_col":0}}},{"name":"Communication between threads","kind":"section_4","ident_start":89763,"ident_end":89792,"extent_start":89758,"extent_end":91267,"fully_qualified_name":"Communication between threads","ident_utf16":{"start":{"line_number":1878,"utf16_col":5},"end":{"line_number":1878,"utf16_col":34}},"extent_utf16":{"start":{"line_number":1878,"utf16_col":0},"end":{"line_number":1895,"utf16_col":0}}},{"name":"Private and shared resources between processes","kind":"section_4","ident_start":91272,"ident_end":91318,"extent_start":91267,"extent_end":91454,"fully_qualified_name":"Private and shared resources between processes","ident_utf16":{"start":{"line_number":1895,"utf16_col":5},"end":{"line_number":1895,"utf16_col":51}},"extent_utf16":{"start":{"line_number":1895,"utf16_col":0},"end":{"line_number":1900,"utf16_col":0}}},{"name":"Private and shared resources between threads","kind":"section_4","ident_start":91459,"ident_end":91503,"extent_start":91454,"extent_end":91623,"fully_qualified_name":"Private and shared resources between threads","ident_utf16":{"start":{"line_number":1900,"utf16_col":5},"end":{"line_number":1900,"utf16_col":49}},"extent_utf16":{"start":{"line_number":1900,"utf16_col":0},"end":{"line_number":1905,"utf16_col":0}}},{"name":"Comparison, advantages and disadvantages of multi-process and multi-thread","kind":"section_4","ident_start":91628,"ident_end":91702,"extent_start":91623,"extent_end":93745,"fully_qualified_name":"Comparison, advantages and disadvantages of multi-process and multi-thread","ident_utf16":{"start":{"line_number":1905,"utf16_col":5},"end":{"line_number":1905,"utf16_col":79}},"extent_utf16":{"start":{"line_number":1905,"utf16_col":0},"end":{"line_number":1935,"utf16_col":0}}},{"name":"Compared","kind":"section_5","ident_start":91710,"ident_end":91718,"extent_start":91704,"extent_end":92802,"fully_qualified_name":"Compared","ident_utf16":{"start":{"line_number":1907,"utf16_col":6},"end":{"line_number":1907,"utf16_col":14}},"extent_utf16":{"start":{"line_number":1907,"utf16_col":0},"end":{"line_number":1918,"utf16_col":0}}},{"name":"Pros and cons","kind":"section_5","ident_start":92808,"ident_end":92821,"extent_start":92802,"extent_end":93174,"fully_qualified_name":"Pros and cons","ident_utf16":{"start":{"line_number":1918,"utf16_col":6},"end":{"line_number":1918,"utf16_col":19}},"extent_utf16":{"start":{"line_number":1918,"utf16_col":0},"end":{"line_number":1925,"utf16_col":0}}},{"name":"Select","kind":"section_5","ident_start":93180,"ident_end":93186,"extent_start":93174,"extent_end":93745,"fully_qualified_name":"Select","ident_utf16":{"start":{"line_number":1925,"utf16_col":6},"end":{"line_number":1925,"utf16_col":12}},"extent_utf16":{"start":{"line_number":1925,"utf16_col":0},"end":{"line_number":1935,"utf16_col":0}}},{"name":"Linux kernel synchronization","kind":"section_3","ident_start":93749,"ident_end":93777,"extent_start":93745,"extent_end":94740,"fully_qualified_name":"Linux kernel synchronization","ident_utf16":{"start":{"line_number":1935,"utf16_col":4},"end":{"line_number":1935,"utf16_col":32}},"extent_utf16":{"start":{"line_number":1935,"utf16_col":0},"end":{"line_number":1955,"utf16_col":0}}},{"name":"the reason","kind":"section_4","ident_start":93784,"ident_end":93794,"extent_start":93779,"extent_end":94244,"fully_qualified_name":"the reason","ident_utf16":{"start":{"line_number":1937,"utf16_col":5},"end":{"line_number":1937,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1937,"utf16_col":0},"end":{"line_number":1941,"utf16_col":0}}},{"name":"Synchronously","kind":"section_4","ident_start":94249,"ident_end":94262,"extent_start":94244,"extent_end":94740,"fully_qualified_name":"Synchronously","ident_utf16":{"start":{"line_number":1941,"utf16_col":5},"end":{"line_number":1941,"utf16_col":18}},"extent_utf16":{"start":{"line_number":1941,"utf16_col":0},"end":{"line_number":1955,"utf16_col":0}}},{"name":"Deadlock","kind":"section_3","ident_start":94744,"ident_end":94752,"extent_start":94740,"extent_end":95803,"fully_qualified_name":"Deadlock","ident_utf16":{"start":{"line_number":1955,"utf16_col":4},"end":{"line_number":1955,"utf16_col":12}},"extent_utf16":{"start":{"line_number":1955,"utf16_col":0},"end":{"line_number":1979,"utf16_col":0}}},{"name":"Reasons","kind":"section_4","ident_start":94759,"ident_end":94766,"extent_start":94754,"extent_end":94898,"fully_qualified_name":"Reasons","ident_utf16":{"start":{"line_number":1957,"utf16_col":5},"end":{"line_number":1957,"utf16_col":12}},"extent_utf16":{"start":{"line_number":1957,"utf16_col":0},"end":{"line_number":1963,"utf16_col":0}}},{"name":"Generate conditions","kind":"section_4","ident_start":94903,"ident_end":94922,"extent_start":94898,"extent_end":94974,"fully_qualified_name":"Generate conditions","ident_utf16":{"start":{"line_number":1963,"utf16_col":5},"end":{"line_number":1963,"utf16_col":24}},"extent_utf16":{"start":{"line_number":1963,"utf16_col":0},"end":{"line_number":1970,"utf16_col":0}}},{"name":"Prevention","kind":"section_4","ident_start":94979,"ident_end":94989,"extent_start":94974,"extent_end":95803,"fully_qualified_name":"Prevention","ident_utf16":{"start":{"line_number":1970,"utf16_col":5},"end":{"line_number":1970,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1970,"utf16_col":0},"end":{"line_number":1979,"utf16_col":0}}},{"name":"File system","kind":"section_3","ident_start":95807,"ident_end":95818,"extent_start":95803,"extent_end":95898,"fully_qualified_name":"File system","ident_utf16":{"start":{"line_number":1979,"utf16_col":4},"end":{"line_number":1979,"utf16_col":15}},"extent_utf16":{"start":{"line_number":1979,"utf16_col":0},"end":{"line_number":1984,"utf16_col":0}}},{"name":"Host byte order and network byte order","kind":"section_3","ident_start":95902,"ident_end":95940,"extent_start":95898,"extent_end":98019,"fully_qualified_name":"Host byte order and network byte order","ident_utf16":{"start":{"line_number":1984,"utf16_col":4},"end":{"line_number":1984,"utf16_col":42}},"extent_utf16":{"start":{"line_number":1984,"utf16_col":0},"end":{"line_number":2044,"utf16_col":0}}},{"name":"Host Endianness (CPU Endianness)","kind":"section_4","ident_start":95947,"ident_end":95979,"extent_start":95942,"extent_end":97687,"fully_qualified_name":"Host Endianness (CPU Endianness)","ident_utf16":{"start":{"line_number":1986,"utf16_col":5},"end":{"line_number":1986,"utf16_col":37}},"extent_utf16":{"start":{"line_number":1986,"utf16_col":0},"end":{"line_number":2038,"utf16_col":0}}},{"name":"Concept","kind":"section_5","ident_start":95987,"ident_end":95994,"extent_start":95981,"extent_end":96446,"fully_qualified_name":"Concept","ident_utf16":{"start":{"line_number":1988,"utf16_col":6},"end":{"line_number":1988,"utf16_col":13}},"extent_utf16":{"start":{"line_number":1988,"utf16_col":0},"end":{"line_number":1995,"utf16_col":0}}},{"name":"Storage method","kind":"section_5","ident_start":96452,"ident_end":96466,"extent_start":96446,"extent_end":96939,"fully_qualified_name":"Storage method","ident_utf16":{"start":{"line_number":1995,"utf16_col":6},"end":{"line_number":1995,"utf16_col":20}},"extent_utf16":{"start":{"line_number":1995,"utf16_col":0},"end":{"line_number":2009,"utf16_col":0}}},{"name":"Judging big-endian little-endian","kind":"section_5","ident_start":96945,"ident_end":96977,"extent_start":96939,"extent_end":97294,"fully_qualified_name":"Judging big-endian little-endian","ident_utf16":{"start":{"line_number":2009,"utf16_col":6},"end":{"line_number":2009,"utf16_col":38}},"extent_utf16":{"start":{"line_number":2009,"utf16_col":0},"end":{"line_number":2032,"utf16_col":0}}},{"name":"Byte order of each architecture processor","kind":"section_5","ident_start":97300,"ident_end":97341,"extent_start":97294,"extent_end":97687,"fully_qualified_name":"Byte order of each architecture processor","ident_utf16":{"start":{"line_number":2032,"utf16_col":6},"end":{"line_number":2032,"utf16_col":47}},"extent_utf16":{"start":{"line_number":2032,"utf16_col":0},"end":{"line_number":2038,"utf16_col":0}}},{"name":"Network byte order","kind":"section_4","ident_start":97692,"ident_end":97710,"extent_start":97687,"extent_end":98019,"fully_qualified_name":"Network byte order","ident_utf16":{"start":{"line_number":2038,"utf16_col":5},"end":{"line_number":2038,"utf16_col":23}},"extent_utf16":{"start":{"line_number":2038,"utf16_col":0},"end":{"line_number":2044,"utf16_col":0}}},{"name":"Page replacement algorithm","kind":"section_3","ident_start":98023,"ident_end":98049,"extent_start":98019,"extent_end":98902,"fully_qualified_name":"Page replacement algorithm","ident_utf16":{"start":{"line_number":2044,"utf16_col":4},"end":{"line_number":2044,"utf16_col":30}},"extent_utf16":{"start":{"line_number":2044,"utf16_col":0},"end":{"line_number":2067,"utf16_col":0}}},{"name":"Categories","kind":"section_4","ident_start":98498,"ident_end":98508,"extent_start":98493,"extent_end":98619,"fully_qualified_name":"Categories","ident_utf16":{"start":{"line_number":2048,"utf16_col":5},"end":{"line_number":2048,"utf16_col":15}},"extent_utf16":{"start":{"line_number":2048,"utf16_col":0},"end":{"line_number":2053,"utf16_col":0}}},{"name":"Algorithm","kind":"section_4","ident_start":98624,"ident_end":98633,"extent_start":98619,"extent_end":98902,"fully_qualified_name":"Algorithm","ident_utf16":{"start":{"line_number":2053,"utf16_col":5},"end":{"line_number":2053,"utf16_col":14}},"extent_utf16":{"start":{"line_number":2053,"utf16_col":0},"end":{"line_number":2067,"utf16_col":0}}},{"name":"☁️ Computer Network","kind":"section_2","ident_start":98905,"ident_end":98928,"extent_start":98902,"extent_end":124919,"fully_qualified_name":"☁️ Computer Network","ident_utf16":{"start":{"line_number":2067,"utf16_col":3},"end":{"line_number":2067,"utf16_col":22}},"extent_utf16":{"start":{"line_number":2067,"utf16_col":0},"end":{"line_number":2476,"utf16_col":0}}},{"name":"Roles and protocols of each layer","kind":"section_3","ident_start":99184,"ident_end":99217,"extent_start":99180,"extent_end":100227,"fully_qualified_name":"Roles and protocols of each layer","ident_utf16":{"start":{"line_number":2075,"utf16_col":4},"end":{"line_number":2075,"utf16_col":37}},"extent_utf16":{"start":{"line_number":2075,"utf16_col":0},"end":{"line_number":2088,"utf16_col":0}}},{"name":"Physical layer","kind":"section_3","ident_start":100231,"ident_end":100245,"extent_start":100227,"extent_end":101457,"fully_qualified_name":"Physical layer","ident_utf16":{"start":{"line_number":2088,"utf16_col":4},"end":{"line_number":2088,"utf16_col":18}},"extent_utf16":{"start":{"line_number":2088,"utf16_col":0},"end":{"line_number":2104,"utf16_col":0}}},{"name":"data link layer","kind":"section_3","ident_start":101461,"ident_end":101476,"extent_start":101457,"extent_end":102516,"fully_qualified_name":"data link layer","ident_utf16":{"start":{"line_number":2104,"utf16_col":4},"end":{"line_number":2104,"utf16_col":19}},"extent_utf16":{"start":{"line_number":2104,"utf16_col":0},"end":{"line_number":2130,"utf16_col":0}}},{"name":"Point-to-point channel","kind":"section_4","ident_start":101543,"ident_end":101565,"extent_start":101538,"extent_end":102128,"fully_qualified_name":"Point-to-point channel","ident_utf16":{"start":{"line_number":2110,"utf16_col":5},"end":{"line_number":2110,"utf16_col":27}},"extent_utf16":{"start":{"line_number":2110,"utf16_col":0},"end":{"line_number":2122,"utf16_col":0}}},{"name":"Broadcast Channel","kind":"section_4","ident_start":102133,"ident_end":102150,"extent_start":102128,"extent_end":102516,"fully_qualified_name":"Broadcast Channel","ident_utf16":{"start":{"line_number":2122,"utf16_col":5},"end":{"line_number":2122,"utf16_col":22}},"extent_utf16":{"start":{"line_number":2122,"utf16_col":0},"end":{"line_number":2130,"utf16_col":0}}},{"name":"Network layer","kind":"section_3","ident_start":102520,"ident_end":102533,"extent_start":102516,"extent_end":105527,"fully_qualified_name":"Network layer","ident_utf16":{"start":{"line_number":2130,"utf16_col":4},"end":{"line_number":2130,"utf16_col":17}},"extent_utf16":{"start":{"line_number":2130,"utf16_col":0},"end":{"line_number":2195,"utf16_col":0}}},{"name":"IP Internet Protocol","kind":"section_4","ident_start":102885,"ident_end":102905,"extent_start":102880,"extent_end":103753,"fully_qualified_name":"IP Internet Protocol","ident_utf16":{"start":{"line_number":2137,"utf16_col":5},"end":{"line_number":2137,"utf16_col":25}},"extent_utf16":{"start":{"line_number":2137,"utf16_col":0},"end":{"line_number":2154,"utf16_col":0}}},{"name":"ICMP Internet Control Message Protocol","kind":"section_4","ident_start":103758,"ident_end":103796,"extent_start":103753,"extent_end":104183,"fully_qualified_name":"ICMP Internet Control Message Protocol","ident_utf16":{"start":{"line_number":2154,"utf16_col":5},"end":{"line_number":2154,"utf16_col":43}},"extent_utf16":{"start":{"line_number":2154,"utf16_col":0},"end":{"line_number":2164,"utf16_col":0}}},{"name":"Interior Gateway Protocol","kind":"section_4","ident_start":104188,"ident_end":104213,"extent_start":104183,"extent_end":104316,"fully_qualified_name":"Interior Gateway Protocol","ident_utf16":{"start":{"line_number":2164,"utf16_col":5},"end":{"line_number":2164,"utf16_col":30}},"extent_utf16":{"start":{"line_number":2164,"utf16_col":0},"end":{"line_number":2169,"utf16_col":0}}},{"name":"External gateway protocol","kind":"section_4","ident_start":104321,"ident_end":104346,"extent_start":104316,"extent_end":104406,"fully_qualified_name":"External gateway protocol","ident_utf16":{"start":{"line_number":2169,"utf16_col":5},"end":{"line_number":2169,"utf16_col":30}},"extent_utf16":{"start":{"line_number":2169,"utf16_col":0},"end":{"line_number":2173,"utf16_col":0}}},{"name":"IP multicast","kind":"section_4","ident_start":104411,"ident_end":104423,"extent_start":104406,"extent_end":104535,"fully_qualified_name":"IP multicast","ident_utf16":{"start":{"line_number":2173,"utf16_col":5},"end":{"line_number":2173,"utf16_col":17}},"extent_utf16":{"start":{"line_number":2173,"utf16_col":0},"end":{"line_number":2178,"utf16_col":0}}},{"name":"VPN and NAT","kind":"section_4","ident_start":104540,"ident_end":104551,"extent_start":104535,"extent_end":104651,"fully_qualified_name":"VPN and NAT","ident_utf16":{"start":{"line_number":2178,"utf16_col":5},"end":{"line_number":2178,"utf16_col":16}},"extent_utf16":{"start":{"line_number":2178,"utf16_col":0},"end":{"line_number":2183,"utf16_col":0}}},{"name":"What does the routing table contain?","kind":"section_4","ident_start":104656,"ident_end":104692,"extent_start":104651,"extent_end":105527,"fully_qualified_name":"What does the routing table contain?","ident_utf16":{"start":{"line_number":2183,"utf16_col":5},"end":{"line_number":2183,"utf16_col":41}},"extent_utf16":{"start":{"line_number":2183,"utf16_col":0},"end":{"line_number":2195,"utf16_col":0}}},{"name":"Transport layer","kind":"section_3","ident_start":105531,"ident_end":105546,"extent_start":105527,"extent_end":117775,"fully_qualified_name":"Transport layer","ident_utf16":{"start":{"line_number":2195,"utf16_col":4},"end":{"line_number":2195,"utf16_col":19}},"extent_utf16":{"start":{"line_number":2195,"utf16_col":0},"end":{"line_number":2386,"utf16_col":0}}},{"name":"TCP","kind":"section_4","ident_start":105842,"ident_end":105845,"extent_start":105837,"extent_end":108118,"fully_qualified_name":"TCP","ident_utf16":{"start":{"line_number":2208,"utf16_col":5},"end":{"line_number":2208,"utf16_col":8}},"extent_utf16":{"start":{"line_number":2208,"utf16_col":0},"end":{"line_number":2242,"utf16_col":0}}},{"name":"UDP","kind":"section_4","ident_start":108123,"ident_end":108126,"extent_start":108118,"extent_end":108932,"fully_qualified_name":"UDP","ident_utf16":{"start":{"line_number":2242,"utf16_col":5},"end":{"line_number":2242,"utf16_col":8}},"extent_utf16":{"start":{"line_number":2242,"utf16_col":0},"end":{"line_number":2264,"utf16_col":0}}},{"name":"Difference between TCP and UDP","kind":"section_4","ident_start":108937,"ident_end":108967,"extent_start":108932,"extent_end":109978,"fully_qualified_name":"Difference between TCP and UDP","ident_utf16":{"start":{"line_number":2264,"utf16_col":5},"end":{"line_number":2264,"utf16_col":35}},"extent_utf16":{"start":{"line_number":2264,"utf16_col":0},"end":{"line_number":2274,"utf16_col":0}}},{"name":"TCP Sticky Packet","kind":"section_4","ident_start":109983,"ident_end":110000,"extent_start":109978,"extent_end":110947,"fully_qualified_name":"TCP Sticky Packet","ident_utf16":{"start":{"line_number":2274,"utf16_col":5},"end":{"line_number":2274,"utf16_col":22}},"extent_utf16":{"start":{"line_number":2274,"utf16_col":0},"end":{"line_number":2287,"utf16_col":0}}},{"name":"the reason","kind":"section_5","ident_start":110008,"ident_end":110018,"extent_start":110002,"extent_end":110226,"fully_qualified_name":"the reason","ident_utf16":{"start":{"line_number":2276,"utf16_col":6},"end":{"line_number":2276,"utf16_col":16}},"extent_utf16":{"start":{"line_number":2276,"utf16_col":0},"end":{"line_number":2280,"utf16_col":0}}},{"name":"Solve","kind":"section_5","ident_start":110232,"ident_end":110237,"extent_start":110226,"extent_end":110947,"fully_qualified_name":"Solve","ident_utf16":{"start":{"line_number":2280,"utf16_col":6},"end":{"line_number":2280,"utf16_col":11}},"extent_utf16":{"start":{"line_number":2280,"utf16_col":0},"end":{"line_number":2287,"utf16_col":0}}},{"name":"TCP Flow Control","kind":"section_4","ident_start":110952,"ident_end":110968,"extent_start":110947,"extent_end":111263,"fully_qualified_name":"TCP Flow Control","ident_utf16":{"start":{"line_number":2287,"utf16_col":5},"end":{"line_number":2287,"utf16_col":21}},"extent_utf16":{"start":{"line_number":2287,"utf16_col":0},"end":{"line_number":2299,"utf16_col":0}}},{"name":"Concept","kind":"section_5","ident_start":110976,"ident_end":110983,"extent_start":110970,"extent_end":111096,"fully_qualified_name":"Concept","ident_utf16":{"start":{"line_number":2289,"utf16_col":6},"end":{"line_number":2289,"utf16_col":13}},"extent_utf16":{"start":{"line_number":2289,"utf16_col":0},"end":{"line_number":2293,"utf16_col":0}}},{"name":"Methods","kind":"section_5","ident_start":111102,"ident_end":111109,"extent_start":111096,"extent_end":111263,"fully_qualified_name":"Methods","ident_utf16":{"start":{"line_number":2293,"utf16_col":6},"end":{"line_number":2293,"utf16_col":13}},"extent_utf16":{"start":{"line_number":2293,"utf16_col":0},"end":{"line_number":2299,"utf16_col":0}}},{"name":"TCP congestion control","kind":"section_4","ident_start":111268,"ident_end":111290,"extent_start":111263,"extent_end":111903,"fully_qualified_name":"TCP congestion control","ident_utf16":{"start":{"line_number":2299,"utf16_col":5},"end":{"line_number":2299,"utf16_col":27}},"extent_utf16":{"start":{"line_number":2299,"utf16_col":0},"end":{"line_number":2320,"utf16_col":0}}},{"name":"Concept","kind":"section_5","ident_start":111298,"ident_end":111305,"extent_start":111292,"extent_end":111462,"fully_qualified_name":"Concept","ident_utf16":{"start":{"line_number":2301,"utf16_col":6},"end":{"line_number":2301,"utf16_col":13}},"extent_utf16":{"start":{"line_number":2301,"utf16_col":0},"end":{"line_number":2305,"utf16_col":0}}},{"name":"Methods","kind":"section_5","ident_start":111468,"ident_end":111475,"extent_start":111462,"extent_end":111903,"fully_qualified_name":"Methods","ident_utf16":{"start":{"line_number":2305,"utf16_col":6},"end":{"line_number":2305,"utf16_col":13}},"extent_utf16":{"start":{"line_number":2305,"utf16_col":0},"end":{"line_number":2320,"utf16_col":0}}},{"name":"TCP Transmission connection management","kind":"section_4","ident_start":111908,"ident_end":111946,"extent_start":111903,"extent_end":117589,"fully_qualified_name":"TCP Transmission connection management","ident_utf16":{"start":{"line_number":2320,"utf16_col":5},"end":{"line_number":2320,"utf16_col":43}},"extent_utf16":{"start":{"line_number":2320,"utf16_col":0},"end":{"line_number":2380,"utf16_col":0}}},{"name":"TCP 三次握手建立连接","kind":"section_5","ident_start":112229,"ident_end":112257,"extent_start":112223,"extent_end":112959,"fully_qualified_name":"TCP 三次握手建立连接","ident_utf16":{"start":{"line_number":2324,"utf16_col":6},"end":{"line_number":2324,"utf16_col":18}},"extent_utf16":{"start":{"line_number":2324,"utf16_col":0},"end":{"line_number":2335,"utf16_col":0}}},{"name":"Why does TCP have to shake hands three times?","kind":"section_5","ident_start":112965,"ident_end":113010,"extent_start":112959,"extent_end":114101,"fully_qualified_name":"Why does TCP have to shake hands three times?","ident_utf16":{"start":{"line_number":2335,"utf16_col":6},"end":{"line_number":2335,"utf16_col":51}},"extent_utf16":{"start":{"line_number":2335,"utf16_col":0},"end":{"line_number":2349,"utf16_col":0}}},{"name":"TCP Four waves to release the connection","kind":"section_5","ident_start":114107,"ident_end":114147,"extent_start":114101,"extent_end":115466,"fully_qualified_name":"TCP Four waves to release the connection","ident_utf16":{"start":{"line_number":2349,"utf16_col":6},"end":{"line_number":2349,"utf16_col":46}},"extent_utf16":{"start":{"line_number":2349,"utf16_col":0},"end":{"line_number":2363,"utf16_col":0}}},{"name":"Why does TCP have to wave four times?","kind":"section_5","ident_start":115472,"ident_end":115509,"extent_start":115466,"extent_end":117589,"fully_qualified_name":"Why does TCP have to wave four times?","ident_utf16":{"start":{"line_number":2363,"utf16_col":6},"end":{"line_number":2363,"utf16_col":43}},"extent_utf16":{"start":{"line_number":2363,"utf16_col":0},"end":{"line_number":2380,"utf16_col":0}}},{"name":"TCP finite state machine","kind":"section_4","ident_start":117594,"ident_end":117618,"extent_start":117589,"extent_end":117775,"fully_qualified_name":"TCP finite state machine","ident_utf16":{"start":{"line_number":2380,"utf16_col":5},"end":{"line_number":2380,"utf16_col":29}},"extent_utf16":{"start":{"line_number":2380,"utf16_col":0},"end":{"line_number":2386,"utf16_col":0}}},{"name":"Application layer","kind":"section_3","ident_start":117779,"ident_end":117796,"extent_start":117775,"extent_end":124919,"fully_qualified_name":"Application layer","ident_utf16":{"start":{"line_number":2386,"utf16_col":4},"end":{"line_number":2386,"utf16_col":21}},"extent_utf16":{"start":{"line_number":2386,"utf16_col":0},"end":{"line_number":2476,"utf16_col":0}}},{"name":"DNS","kind":"section_4","ident_start":117803,"ident_end":117806,"extent_start":117798,"extent_end":118335,"fully_qualified_name":"DNS","ident_utf16":{"start":{"line_number":2388,"utf16_col":5},"end":{"line_number":2388,"utf16_col":8}},"extent_utf16":{"start":{"line_number":2388,"utf16_col":0},"end":{"line_number":2395,"utf16_col":0}}},{"name":"FTP","kind":"section_4","ident_start":118340,"ident_end":118343,"extent_start":118335,"extent_end":118817,"fully_qualified_name":"FTP","ident_utf16":{"start":{"line_number":2395,"utf16_col":5},"end":{"line_number":2395,"utf16_col":8}},"extent_utf16":{"start":{"line_number":2395,"utf16_col":0},"end":{"line_number":2400,"utf16_col":0}}},{"name":"TELNET","kind":"section_4","ident_start":118822,"ident_end":118828,"extent_start":118817,"extent_end":119874,"fully_qualified_name":"TELNET","ident_utf16":{"start":{"line_number":2400,"utf16_col":5},"end":{"line_number":2400,"utf16_col":11}},"extent_utf16":{"start":{"line_number":2400,"utf16_col":0},"end":{"line_number":2409,"utf16_col":0}}},{"name":"WWW","kind":"section_4","ident_start":119879,"ident_end":119882,"extent_start":119874,"extent_end":124919,"fully_qualified_name":"WWW","ident_utf16":{"start":{"line_number":2409,"utf16_col":5},"end":{"line_number":2409,"utf16_col":8}},"extent_utf16":{"start":{"line_number":2409,"utf16_col":0},"end":{"line_number":2476,"utf16_col":0}}},{"name":"URL","kind":"section_5","ident_start":120032,"ident_end":120035,"extent_start":120026,"extent_end":120636,"fully_qualified_name":"URL","ident_utf16":{"start":{"line_number":2413,"utf16_col":6},"end":{"line_number":2413,"utf16_col":9}},"extent_utf16":{"start":{"line_number":2413,"utf16_col":0},"end":{"line_number":2428,"utf16_col":0}}},{"name":"HTTP","kind":"section_5","ident_start":120642,"ident_end":120646,"extent_start":120636,"extent_end":123840,"fully_qualified_name":"HTTP","ident_utf16":{"start":{"line_number":2428,"utf16_col":6},"end":{"line_number":2428,"utf16_col":10}},"extent_utf16":{"start":{"line_number":2428,"utf16_col":0},"end":{"line_number":2466,"utf16_col":0}}},{"name":"Other agreements","kind":"section_5","ident_start":123846,"ident_end":123862,"extent_start":123840,"extent_end":124919,"fully_qualified_name":"Other agreements","ident_utf16":{"start":{"line_number":2466,"utf16_col":6},"end":{"line_number":2466,"utf16_col":22}},"extent_utf16":{"start":{"line_number":2466,"utf16_col":0},"end":{"line_number":2476,"utf16_col":0}}},{"name":"🌩 Network Programming","kind":"section_2","ident_start":124922,"ident_end":124946,"extent_start":124919,"extent_end":128989,"fully_qualified_name":"🌩 Network Programming","ident_utf16":{"start":{"line_number":2476,"utf16_col":3},"end":{"line_number":2476,"utf16_col":25}},"extent_utf16":{"start":{"line_number":2476,"utf16_col":0},"end":{"line_number":2543,"utf16_col":0}}},{"name":"Socket","kind":"section_3","ident_start":124952,"ident_end":124958,"extent_start":124948,"extent_end":128989,"fully_qualified_name":"Socket","ident_utf16":{"start":{"line_number":2478,"utf16_col":4},"end":{"line_number":2478,"utf16_col":10}},"extent_utf16":{"start":{"line_number":2478,"utf16_col":0},"end":{"line_number":2543,"utf16_col":0}}},{"name":"Socket middle read()、write() function","kind":"section_4","ident_start":125220,"ident_end":125259,"extent_start":125215,"extent_end":126504,"fully_qualified_name":"Socket middle read()、write() function","ident_utf16":{"start":{"line_number":2485,"utf16_col":5},"end":{"line_number":2485,"utf16_col":42}},"extent_utf16":{"start":{"line_number":2485,"utf16_col":0},"end":{"line_number":2508,"utf16_col":0}}},{"name":"read()","kind":"section_5","ident_start":125380,"ident_end":125386,"extent_start":125374,"extent_end":125790,"fully_qualified_name":"read()","ident_utf16":{"start":{"line_number":2492,"utf16_col":6},"end":{"line_number":2492,"utf16_col":12}},"extent_utf16":{"start":{"line_number":2492,"utf16_col":0},"end":{"line_number":2499,"utf16_col":0}}},{"name":"write ()","kind":"section_5","ident_start":125796,"ident_end":125804,"extent_start":125790,"extent_end":126504,"fully_qualified_name":"write ()","ident_utf16":{"start":{"line_number":2499,"utf16_col":6},"end":{"line_number":2499,"utf16_col":14}},"extent_utf16":{"start":{"line_number":2499,"utf16_col":0},"end":{"line_number":2508,"utf16_col":0}}},{"name":"TCP three-way handshake in socket to establish connection","kind":"section_4","ident_start":126509,"ident_end":126566,"extent_start":126504,"extent_end":127820,"fully_qualified_name":"TCP three-way handshake in socket to establish connection","ident_utf16":{"start":{"line_number":2508,"utf16_col":5},"end":{"line_number":2508,"utf16_col":62}},"extent_utf16":{"start":{"line_number":2508,"utf16_col":0},"end":{"line_number":2526,"utf16_col":0}}},{"name":"TCP four-way handshake in socket to release connection","kind":"section_4","ident_start":127825,"ident_end":127879,"extent_start":127820,"extent_end":128989,"fully_qualified_name":"TCP four-way handshake in socket to release connection","ident_utf16":{"start":{"line_number":2526,"utf16_col":5},"end":{"line_number":2526,"utf16_col":59}},"extent_utf16":{"start":{"line_number":2526,"utf16_col":0},"end":{"line_number":2543,"utf16_col":0}}},{"name":"💾 Database","kind":"section_2","ident_start":128992,"ident_end":129005,"extent_start":128989,"extent_end":136944,"fully_qualified_name":"💾 Database","ident_utf16":{"start":{"line_number":2543,"utf16_col":3},"end":{"line_number":2543,"utf16_col":14}},"extent_utf16":{"start":{"line_number":2543,"utf16_col":0},"end":{"line_number":2670,"utf16_col":0}}},{"name":"basic concepts","kind":"section_3","ident_start":129112,"ident_end":129126,"extent_start":129108,"extent_end":131069,"fully_qualified_name":"basic concepts","ident_utf16":{"start":{"line_number":2547,"utf16_col":4},"end":{"line_number":2547,"utf16_col":18}},"extent_utf16":{"start":{"line_number":2547,"utf16_col":0},"end":{"line_number":2563,"utf16_col":0}}},{"name":"Common data models","kind":"section_3","ident_start":131073,"ident_end":131091,"extent_start":131069,"extent_end":131750,"fully_qualified_name":"Common data models","ident_utf16":{"start":{"line_number":2563,"utf16_col":4},"end":{"line_number":2563,"utf16_col":22}},"extent_utf16":{"start":{"line_number":2563,"utf16_col":0},"end":{"line_number":2579,"utf16_col":0}}},{"name":"Common SQL Operations","kind":"section_3","ident_start":131754,"ident_end":131775,"extent_start":131750,"extent_end":132870,"fully_qualified_name":"Common SQL Operations","ident_utf16":{"start":{"line_number":2579,"utf16_col":4},"end":{"line_number":2579,"utf16_col":25}},"extent_utf16":{"start":{"line_number":2579,"utf16_col":0},"end":{"line_number":2617,"utf16_col":0}}},{"name":"Relational Database","kind":"section_3","ident_start":132874,"ident_end":132893,"extent_start":132870,"extent_end":133506,"fully_qualified_name":"Relational Database","ident_utf16":{"start":{"line_number":2617,"utf16_col":4},"end":{"line_number":2617,"utf16_col":23}},"extent_utf16":{"start":{"line_number":2617,"utf16_col":0},"end":{"line_number":2627,"utf16_col":0}}},{"name":"Index","kind":"section_4","ident_start":133309,"ident_end":133314,"extent_start":133304,"extent_end":133506,"fully_qualified_name":"Index","ident_utf16":{"start":{"line_number":2622,"utf16_col":5},"end":{"line_number":2622,"utf16_col":10}},"extent_utf16":{"start":{"line_number":2622,"utf16_col":0},"end":{"line_number":2627,"utf16_col":0}}},{"name":"Database integrity","kind":"section_3","ident_start":133510,"ident_end":133528,"extent_start":133506,"extent_end":133863,"fully_qualified_name":"Database integrity","ident_utf16":{"start":{"line_number":2627,"utf16_col":4},"end":{"line_number":2627,"utf16_col":22}},"extent_utf16":{"start":{"line_number":2627,"utf16_col":0},"end":{"line_number":2634,"utf16_col":0}}},{"name":"Relational data theory","kind":"section_3","ident_start":133867,"ident_end":133889,"extent_start":133863,"extent_end":135147,"fully_qualified_name":"Relational data theory","ident_utf16":{"start":{"line_number":2634,"utf16_col":4},"end":{"line_number":2634,"utf16_col":26}},"extent_utf16":{"start":{"line_number":2634,"utf16_col":0},"end":{"line_number":2647,"utf16_col":0}}},{"name":"Paradigm","kind":"section_4","ident_start":134206,"ident_end":134214,"extent_start":134201,"extent_end":135147,"fully_qualified_name":"Paradigm","ident_utf16":{"start":{"line_number":2639,"utf16_col":5},"end":{"line_number":2639,"utf16_col":13}},"extent_utf16":{"start":{"line_number":2639,"utf16_col":0},"end":{"line_number":2647,"utf16_col":0}}},{"name":"Database Recovery","kind":"section_3","ident_start":135151,"ident_end":135168,"extent_start":135147,"extent_end":135715,"fully_qualified_name":"Database Recovery","ident_utf16":{"start":{"line_number":2647,"utf16_col":4},"end":{"line_number":2647,"utf16_col":21}},"extent_utf16":{"start":{"line_number":2647,"utf16_col":0},"end":{"line_number":2654,"utf16_col":0}}},{"name":"Concurrency control","kind":"section_3","ident_start":135719,"ident_end":135738,"extent_start":135715,"extent_end":136944,"fully_qualified_name":"Concurrency control","ident_utf16":{"start":{"line_number":2654,"utf16_col":4},"end":{"line_number":2654,"utf16_col":23}},"extent_utf16":{"start":{"line_number":2654,"utf16_col":0},"end":{"line_number":2670,"utf16_col":0}}},{"name":"📏 Design pattern","kind":"section_2","ident_start":136947,"ident_end":136966,"extent_start":136944,"extent_end":137871,"fully_qualified_name":"📏 Design pattern","ident_utf16":{"start":{"line_number":2670,"utf16_col":3},"end":{"line_number":2670,"utf16_col":20}},"extent_utf16":{"start":{"line_number":2670,"utf16_col":0},"end":{"line_number":2707,"utf16_col":0}}},{"name":"Singleton mode","kind":"section_3","ident_start":137178,"ident_end":137192,"extent_start":137174,"extent_end":137255,"fully_qualified_name":"Singleton mode","ident_utf16":{"start":{"line_number":2676,"utf16_col":4},"end":{"line_number":2676,"utf16_col":18}},"extent_utf16":{"start":{"line_number":2676,"utf16_col":0},"end":{"line_number":2680,"utf16_col":0}}},{"name":"Abstract factory pattern","kind":"section_3","ident_start":137259,"ident_end":137283,"extent_start":137255,"extent_end":137359,"fully_qualified_name":"Abstract factory pattern","ident_utf16":{"start":{"line_number":2680,"utf16_col":4},"end":{"line_number":2680,"utf16_col":28}},"extent_utf16":{"start":{"line_number":2680,"utf16_col":0},"end":{"line_number":2684,"utf16_col":0}}},{"name":"Adapter Mode","kind":"section_3","ident_start":137363,"ident_end":137375,"extent_start":137359,"extent_end":137434,"fully_qualified_name":"Adapter Mode","ident_utf16":{"start":{"line_number":2684,"utf16_col":4},"end":{"line_number":2684,"utf16_col":16}},"extent_utf16":{"start":{"line_number":2684,"utf16_col":0},"end":{"line_number":2688,"utf16_col":0}}},{"name":"Bridge mode","kind":"section_3","ident_start":137438,"ident_end":137449,"extent_start":137434,"extent_end":137506,"fully_qualified_name":"Bridge mode","ident_utf16":{"start":{"line_number":2688,"utf16_col":4},"end":{"line_number":2688,"utf16_col":15}},"extent_utf16":{"start":{"line_number":2688,"utf16_col":0},"end":{"line_number":2692,"utf16_col":0}}},{"name":"Observer mode","kind":"section_3","ident_start":137510,"ident_end":137523,"extent_start":137506,"extent_end":137587,"fully_qualified_name":"Observer mode","ident_utf16":{"start":{"line_number":2692,"utf16_col":4},"end":{"line_number":2692,"utf16_col":17}},"extent_utf16":{"start":{"line_number":2692,"utf16_col":0},"end":{"line_number":2696,"utf16_col":0}}},{"name":"Six Principles of Design Patterns","kind":"section_3","ident_start":137591,"ident_end":137624,"extent_start":137587,"extent_end":137871,"fully_qualified_name":"Six Principles of Design Patterns","ident_utf16":{"start":{"line_number":2696,"utf16_col":4},"end":{"line_number":2696,"utf16_col":37}},"extent_utf16":{"start":{"line_number":2696,"utf16_col":0},"end":{"line_number":2707,"utf16_col":0}}},{"name":"⚙️ Link Loading Library","kind":"section_2","ident_start":137874,"ident_end":137901,"extent_start":137871,"extent_end":156606,"fully_qualified_name":"⚙️ Link Loading Library","ident_utf16":{"start":{"line_number":2707,"utf16_col":3},"end":{"line_number":2707,"utf16_col":26}},"extent_utf16":{"start":{"line_number":2707,"utf16_col":0},"end":{"line_number":3261,"utf16_col":0}}},{"name":"memory, stack, heap","kind":"section_3","ident_start":138012,"ident_end":138031,"extent_start":138008,"extent_end":140104,"fully_qualified_name":"memory, stack, heap","ident_utf16":{"start":{"line_number":2711,"utf16_col":4},"end":{"line_number":2711,"utf16_col":23}},"extent_utf16":{"start":{"line_number":2711,"utf16_col":0},"end":{"line_number":2745,"utf16_col":0}}},{"name":"stack","kind":"section_4","ident_start":138963,"ident_end":138968,"extent_start":138958,"extent_end":139428,"fully_qualified_name":"stack","ident_utf16":{"start":{"line_number":2720,"utf16_col":5},"end":{"line_number":2720,"utf16_col":10}},"extent_utf16":{"start":{"line_number":2720,"utf16_col":0},"end":{"line_number":2728,"utf16_col":0}}},{"name":"Heap","kind":"section_4","ident_start":139433,"ident_end":139437,"extent_start":139428,"extent_end":139503,"fully_qualified_name":"Heap","ident_utf16":{"start":{"line_number":2728,"utf16_col":5},"end":{"line_number":2728,"utf16_col":9}},"extent_utf16":{"start":{"line_number":2728,"utf16_col":0},"end":{"line_number":2736,"utf16_col":0}}},{"name":"\"Segment fault\" or \"Illegal operation, this memory address cannot be read / write\"","kind":"section_4","ident_start":139508,"ident_end":139590,"extent_start":139503,"extent_end":140104,"fully_qualified_name":"\"Segment fault\" or \"Illegal operation, this memory address cannot be read / write\"","ident_utf16":{"start":{"line_number":2736,"utf16_col":5},"end":{"line_number":2736,"utf16_col":87}},"extent_utf16":{"start":{"line_number":2736,"utf16_col":0},"end":{"line_number":2745,"utf16_col":0}}},{"name":"Compile and link","kind":"section_3","ident_start":140108,"ident_end":140124,"extent_start":140104,"extent_end":143461,"fully_qualified_name":"Compile and link","ident_utf16":{"start":{"line_number":2745,"utf16_col":4},"end":{"line_number":2745,"utf16_col":20}},"extent_utf16":{"start":{"line_number":2745,"utf16_col":0},"end":{"line_number":2808,"utf16_col":0}}},{"name":"File formats for each platform","kind":"section_4","ident_start":140131,"ident_end":140161,"extent_start":140126,"extent_end":140376,"fully_qualified_name":"File formats for each platform","ident_utf16":{"start":{"line_number":2747,"utf16_col":5},"end":{"line_number":2747,"utf16_col":35}},"extent_utf16":{"start":{"line_number":2747,"utf16_col":0},"end":{"line_number":2755,"utf16_col":0}}},{"name":"Compile and link process","kind":"section_4","ident_start":140381,"ident_end":140405,"extent_start":140376,"extent_end":141180,"fully_qualified_name":"Compile and link process","ident_utf16":{"start":{"line_number":2755,"utf16_col":5},"end":{"line_number":2755,"utf16_col":29}},"extent_utf16":{"start":{"line_number":2755,"utf16_col":0},"end":{"line_number":2766,"utf16_col":0}}},{"name":"target document","kind":"section_4","ident_start":141185,"ident_end":141200,"extent_start":141180,"extent_end":143032,"fully_qualified_name":"target document","ident_utf16":{"start":{"line_number":2766,"utf16_col":5},"end":{"line_number":2766,"utf16_col":20}},"extent_utf16":{"start":{"line_number":2766,"utf16_col":0},"end":{"line_number":2796,"utf16_col":0}}},{"name":"Object file format","kind":"section_5","ident_start":141779,"ident_end":141797,"extent_start":141773,"extent_end":142068,"fully_qualified_name":"Object file format","ident_utf16":{"start":{"line_number":2772,"utf16_col":6},"end":{"line_number":2772,"utf16_col":24}},"extent_utf16":{"start":{"line_number":2772,"utf16_col":0},"end":{"line_number":2782,"utf16_col":0}}},{"name":"Object file storage structure","kind":"section_5","ident_start":142074,"ident_end":142103,"extent_start":142068,"extent_end":143032,"fully_qualified_name":"Object file storage structure","ident_utf16":{"start":{"line_number":2782,"utf16_col":6},"end":{"line_number":2782,"utf16_col":35}},"extent_utf16":{"start":{"line_number":2782,"utf16_col":0},"end":{"line_number":2796,"utf16_col":0}}},{"name":"Linked Interface-Symbol","kind":"section_4","ident_start":143037,"ident_end":143060,"extent_start":143032,"extent_end":143461,"fully_qualified_name":"Linked Interface-Symbol","ident_utf16":{"start":{"line_number":2796,"utf16_col":5},"end":{"line_number":2796,"utf16_col":28}},"extent_utf16":{"start":{"line_number":2796,"utf16_col":0},"end":{"line_number":2808,"utf16_col":0}}},{"name":"Shared Library for Linux","kind":"section_3","ident_start":143465,"ident_end":143489,"extent_start":143461,"extent_end":146758,"fully_qualified_name":"Shared Library for Linux","ident_utf16":{"start":{"line_number":2808,"utf16_col":4},"end":{"line_number":2808,"utf16_col":28}},"extent_utf16":{"start":{"line_number":2808,"utf16_col":0},"end":{"line_number":2946,"utf16_col":0}}},{"name":"Name","kind":"section_4","ident_start":143685,"ident_end":143689,"extent_start":143680,"extent_end":143997,"fully_qualified_name":"Name","ident_utf16":{"start":{"line_number":2814,"utf16_col":5},"end":{"line_number":2814,"utf16_col":9}},"extent_utf16":{"start":{"line_number":2814,"utf16_col":0},"end":{"line_number":2822,"utf16_col":0}}},{"name":"path","kind":"section_4","ident_start":144002,"ident_end":144006,"extent_start":143997,"extent_end":144745,"fully_qualified_name":"path","ident_utf16":{"start":{"line_number":2822,"utf16_col":5},"end":{"line_number":2822,"utf16_col":9}},"extent_utf16":{"start":{"line_number":2822,"utf16_col":0},"end":{"line_number":2832,"utf16_col":0}}},{"name":"Environment variables","kind":"section_4","ident_start":144750,"ident_end":144771,"extent_start":144745,"extent_end":145054,"fully_qualified_name":"Environment variables","ident_utf16":{"start":{"line_number":2832,"utf16_col":5},"end":{"line_number":2832,"utf16_col":26}},"extent_utf16":{"start":{"line_number":2832,"utf16_col":0},"end":{"line_number":2838,"utf16_col":0}}},{"name":"So shared library writing","kind":"section_4","ident_start":145059,"ident_end":145084,"extent_start":145054,"extent_end":145802,"fully_qualified_name":"So shared library writing","ident_utf16":{"start":{"line_number":2838,"utf16_col":5},"end":{"line_number":2838,"utf16_col":30}},"extent_utf16":{"start":{"line_number":2838,"utf16_col":0},"end":{"line_number":2890,"utf16_col":0}}},{"name":"use of so shared library (called by executable project)","kind":"section_4","ident_start":145807,"ident_end":145862,"extent_start":145802,"extent_end":146758,"fully_qualified_name":"use of so shared library (called by executable project)","ident_utf16":{"start":{"line_number":2890,"utf16_col":5},"end":{"line_number":2890,"utf16_col":60}},"extent_utf16":{"start":{"line_number":2890,"utf16_col":0},"end":{"line_number":2946,"utf16_col":0}}},{"name":"Windows Application entry function","kind":"section_3","ident_start":146762,"ident_end":146796,"extent_start":146758,"extent_end":147710,"fully_qualified_name":"Windows Application entry function","ident_utf16":{"start":{"line_number":2946,"utf16_col":4},"end":{"line_number":2946,"utf16_col":38}},"extent_utf16":{"start":{"line_number":2946,"utf16_col":0},"end":{"line_number":2974,"utf16_col":0}}},{"name":"Dynamic-Link Library for Windows","kind":"section_3","ident_start":147714,"ident_end":147746,"extent_start":147710,"extent_end":154106,"fully_qualified_name":"Dynamic-Link Library for Windows","ident_utf16":{"start":{"line_number":2974,"utf16_col":4},"end":{"line_number":2974,"utf16_col":36}},"extent_utf16":{"start":{"line_number":2974,"utf16_col":0},"end":{"line_number":3200,"utf16_col":0}}},{"name":"Uses","kind":"section_4","ident_start":147832,"ident_end":147836,"extent_start":147827,"extent_end":148063,"fully_qualified_name":"Uses","ident_utf16":{"start":{"line_number":2978,"utf16_col":5},"end":{"line_number":2978,"utf16_col":9}},"extent_utf16":{"start":{"line_number":2978,"utf16_col":0},"end":{"line_number":2988,"utf16_col":0}}},{"name":"Note","kind":"section_4","ident_start":148068,"ident_end":148072,"extent_start":148063,"extent_end":148711,"fully_qualified_name":"Note","ident_utf16":{"start":{"line_number":2988,"utf16_col":5},"end":{"line_number":2988,"utf16_col":9}},"extent_utf16":{"start":{"line_number":2988,"utf16_col":0},"end":{"line_number":2997,"utf16_col":0}}},{"name":"Search order for loading Windows programs","kind":"section_4","ident_start":148716,"ident_end":148757,"extent_start":148711,"extent_end":149120,"fully_qualified_name":"Search order for loading Windows programs","ident_utf16":{"start":{"line_number":2997,"utf16_col":5},"end":{"line_number":2997,"utf16_col":46}},"extent_utf16":{"start":{"line_number":2997,"utf16_col":0},"end":{"line_number":3006,"utf16_col":0}}},{"name":"DLL Entry function","kind":"section_4","ident_start":149125,"ident_end":149143,"extent_start":149120,"extent_end":150196,"fully_qualified_name":"DLL Entry function","ident_utf16":{"start":{"line_number":3006,"utf16_col":5},"end":{"line_number":3006,"utf16_col":23}},"extent_utf16":{"start":{"line_number":3006,"utf16_col":0},"end":{"line_number":3037,"utf16_col":0}}},{"name":"Load and unload library","kind":"section_4","ident_start":150201,"ident_end":150224,"extent_start":150196,"extent_end":150944,"fully_qualified_name":"Load and unload library","ident_utf16":{"start":{"line_number":3037,"utf16_col":5},"end":{"line_number":3037,"utf16_col":28}},"extent_utf16":{"start":{"line_number":3037,"utf16_col":0},"end":{"line_number":3068,"utf16_col":0}}},{"name":"Display link to export symbol","kind":"section_4","ident_start":150949,"ident_end":150978,"extent_start":150944,"extent_end":151144,"fully_qualified_name":"Display link to export symbol","ident_utf16":{"start":{"line_number":3068,"utf16_col":5},"end":{"line_number":3068,"utf16_col":34}},"extent_utf16":{"start":{"line_number":3068,"utf16_col":0},"end":{"line_number":3079,"utf16_col":0}}},{"name":"DumpBin.exe View DLL information","kind":"section_4","ident_start":151149,"ident_end":151181,"extent_start":151144,"extent_end":151427,"fully_qualified_name":"DumpBin.exe View DLL information","ident_utf16":{"start":{"line_number":3079,"utf16_col":5},"end":{"line_number":3079,"utf16_col":37}},"extent_utf16":{"start":{"line_number":3079,"utf16_col":0},"end":{"line_number":3086,"utf16_col":0}}},{"name":"Flow chart of LoadLibrary and FreeLibrary","kind":"section_4","ident_start":151432,"ident_end":151473,"extent_start":151427,"extent_end":151776,"fully_qualified_name":"Flow chart of LoadLibrary and FreeLibrary","ident_utf16":{"start":{"line_number":3086,"utf16_col":5},"end":{"line_number":3086,"utf16_col":46}},"extent_utf16":{"start":{"line_number":3086,"utf16_col":0},"end":{"line_number":3098,"utf16_col":0}}},{"name":"LoadLibrary","kind":"section_5","ident_start":151520,"ident_end":151531,"extent_start":151514,"extent_end":151645,"fully_qualified_name":"LoadLibrary","ident_utf16":{"start":{"line_number":3090,"utf16_col":6},"end":{"line_number":3090,"utf16_col":17}},"extent_utf16":{"start":{"line_number":3090,"utf16_col":0},"end":{"line_number":3094,"utf16_col":0}}},{"name":"FreeLibrary","kind":"section_5","ident_start":151651,"ident_end":151662,"extent_start":151645,"extent_end":151776,"fully_qualified_name":"FreeLibrary","ident_utf16":{"start":{"line_number":3094,"utf16_col":6},"end":{"line_number":3094,"utf16_col":17}},"extent_utf16":{"start":{"line_number":3094,"utf16_col":0},"end":{"line_number":3098,"utf16_col":0}}},{"name":"Writing of DLL library (export a DLL module)","kind":"section_4","ident_start":151781,"ident_end":151825,"extent_start":151776,"extent_end":152938,"fully_qualified_name":"Writing of DLL library (export a DLL module)","ident_utf16":{"start":{"line_number":3098,"utf16_col":5},"end":{"line_number":3098,"utf16_col":49}},"extent_utf16":{"start":{"line_number":3098,"utf16_col":0},"end":{"line_number":3151,"utf16_col":0}}},{"name":"Use of DLL library (dynamic link DLL at runtime)","kind":"section_4","ident_start":152943,"ident_end":152991,"extent_start":152938,"extent_end":154106,"fully_qualified_name":"Use of DLL library (dynamic link DLL at runtime)","ident_utf16":{"start":{"line_number":3151,"utf16_col":5},"end":{"line_number":3151,"utf16_col":53}},"extent_utf16":{"start":{"line_number":3151,"utf16_col":0},"end":{"line_number":3200,"utf16_col":0}}},{"name":"Runtime(Runtime Library)","kind":"section_3","ident_start":154110,"ident_end":154138,"extent_start":154106,"extent_end":156606,"fully_qualified_name":"Runtime(Runtime Library)","ident_utf16":{"start":{"line_number":3200,"utf16_col":4},"end":{"line_number":3200,"utf16_col":28}},"extent_utf16":{"start":{"line_number":3200,"utf16_col":0},"end":{"line_number":3261,"utf16_col":0}}},{"name":"Typical program operation steps","kind":"section_4","ident_start":154145,"ident_end":154176,"extent_start":154140,"extent_end":155074,"fully_qualified_name":"Typical program operation steps","ident_utf16":{"start":{"line_number":3202,"utf16_col":5},"end":{"line_number":3202,"utf16_col":36}},"extent_utf16":{"start":{"line_number":3202,"utf16_col":0},"end":{"line_number":3211,"utf16_col":0}}},{"name":"glibc entry","kind":"section_4","ident_start":155079,"ident_end":155090,"extent_start":155074,"extent_end":155218,"fully_qualified_name":"glibc entry","ident_utf16":{"start":{"line_number":3211,"utf16_col":5},"end":{"line_number":3211,"utf16_col":16}},"extent_utf16":{"start":{"line_number":3211,"utf16_col":0},"end":{"line_number":3217,"utf16_col":0}}},{"name":"MSVC CRT Entry","kind":"section_4","ident_start":155223,"ident_end":155237,"extent_start":155218,"extent_end":155590,"fully_qualified_name":"MSVC CRT Entry","ident_utf16":{"start":{"line_number":3217,"utf16_col":5},"end":{"line_number":3217,"utf16_col":19}},"extent_utf16":{"start":{"line_number":3217,"utf16_col":0},"end":{"line_number":3231,"utf16_col":0}}},{"name":"C Language Runtime (CRT)","kind":"section_4","ident_start":155595,"ident_end":155619,"extent_start":155590,"extent_end":156138,"fully_qualified_name":"C Language Runtime (CRT)","ident_utf16":{"start":{"line_number":3231,"utf16_col":5},"end":{"line_number":3231,"utf16_col":29}},"extent_utf16":{"start":{"line_number":3231,"utf16_col":0},"end":{"line_number":3242,"utf16_col":0}}},{"name":"C Language Standard Library (ANSI C)","kind":"section_4","ident_start":156143,"ident_end":156179,"extent_start":156138,"extent_end":156606,"fully_qualified_name":"C Language Standard Library (ANSI C)","ident_utf16":{"start":{"line_number":3242,"utf16_col":5},"end":{"line_number":3242,"utf16_col":41}},"extent_utf16":{"start":{"line_number":3242,"utf16_col":0},"end":{"line_number":3261,"utf16_col":0}}},{"name":"📚 Books","kind":"section_2","ident_start":156609,"ident_end":156619,"extent_start":156606,"extent_end":157282,"fully_qualified_name":"📚 Books","ident_utf16":{"start":{"line_number":3261,"utf16_col":3},"end":{"line_number":3261,"utf16_col":11}},"extent_utf16":{"start":{"line_number":3261,"utf16_col":0},"end":{"line_number":3297,"utf16_col":0}}},{"name":"Language","kind":"section_3","ident_start":156719,"ident_end":156727,"extent_start":156715,"extent_end":156882,"fully_qualified_name":"Language","ident_utf16":{"start":{"line_number":3265,"utf16_col":4},"end":{"line_number":3265,"utf16_col":12}},"extent_utf16":{"start":{"line_number":3265,"utf16_col":0},"end":{"line_number":3274,"utf16_col":0}}},{"name":"Algorithm","kind":"section_3","ident_start":156886,"ident_end":156895,"extent_start":156882,"extent_end":156980,"fully_qualified_name":"Algorithm","ident_utf16":{"start":{"line_number":3274,"utf16_col":4},"end":{"line_number":3274,"utf16_col":13}},"extent_utf16":{"start":{"line_number":3274,"utf16_col":0},"end":{"line_number":3280,"utf16_col":0}}},{"name":"System","kind":"section_3","ident_start":156984,"ident_end":156990,"extent_start":156980,"extent_end":157106,"fully_qualified_name":"System","ident_utf16":{"start":{"line_number":3280,"utf16_col":4},"end":{"line_number":3280,"utf16_col":10}},"extent_utf16":{"start":{"line_number":3280,"utf16_col":0},"end":{"line_number":3286,"utf16_col":0}}},{"name":"The internet","kind":"section_3","ident_start":157110,"ident_end":157122,"extent_start":157106,"extent_end":157191,"fully_qualified_name":"The internet","ident_utf16":{"start":{"line_number":3286,"utf16_col":4},"end":{"line_number":3286,"utf16_col":16}},"extent_utf16":{"start":{"line_number":3286,"utf16_col":0},"end":{"line_number":3291,"utf16_col":0}}},{"name":"Other","kind":"section_3","ident_start":157195,"ident_end":157200,"extent_start":157191,"extent_end":157282,"fully_qualified_name":"Other","ident_utf16":{"start":{"line_number":3291,"utf16_col":4},"end":{"line_number":3291,"utf16_col":9}},"extent_utf16":{"start":{"line_number":3291,"utf16_col":0},"end":{"line_number":3297,"utf16_col":0}}},{"name":"🔱 C / C ++ Development Direction","kind":"section_2","ident_start":157285,"ident_end":157320,"extent_start":157282,"extent_end":162754,"fully_qualified_name":"🔱 C / C ++ Development Direction","ident_utf16":{"start":{"line_number":3297,"utf16_col":3},"end":{"line_number":3297,"utf16_col":36}},"extent_utf16":{"start":{"line_number":3297,"utf16_col":0},"end":{"line_number":3385,"utf16_col":0}}},{"name":"Backend / Server","kind":"section_3","ident_start":157530,"ident_end":157546,"extent_start":157526,"extent_end":158338,"fully_qualified_name":"Backend / Server","ident_utf16":{"start":{"line_number":3301,"utf16_col":4},"end":{"line_number":3301,"utf16_col":20}},"extent_utf16":{"start":{"line_number":3301,"utf16_col":0},"end":{"line_number":3312,"utf16_col":0}}},{"name":"Desktop Client","kind":"section_3","ident_start":158342,"ident_end":158356,"extent_start":158338,"extent_end":159052,"fully_qualified_name":"Desktop Client","ident_utf16":{"start":{"line_number":3312,"utf16_col":4},"end":{"line_number":3312,"utf16_col":18}},"extent_utf16":{"start":{"line_number":3312,"utf16_col":0},"end":{"line_number":3322,"utf16_col":0}}},{"name":"Graphics / Game / VR / AR","kind":"section_3","ident_start":159056,"ident_end":159081,"extent_start":159052,"extent_end":159857,"fully_qualified_name":"Graphics / Game / VR / AR","ident_utf16":{"start":{"line_number":3322,"utf16_col":4},"end":{"line_number":3322,"utf16_col":29}},"extent_utf16":{"start":{"line_number":3322,"utf16_col":0},"end":{"line_number":3334,"utf16_col":0}}},{"name":"Test Development","kind":"section_3","ident_start":159861,"ident_end":159877,"extent_start":159857,"extent_end":160346,"fully_qualified_name":"Test Development","ident_utf16":{"start":{"line_number":3334,"utf16_col":4},"end":{"line_number":3334,"utf16_col":20}},"extent_utf16":{"start":{"line_number":3334,"utf16_col":0},"end":{"line_number":3345,"utf16_col":0}}},{"name":"Cyber Security / Reverse","kind":"section_3","ident_start":160350,"ident_end":160374,"extent_start":160346,"extent_end":160906,"fully_qualified_name":"Cyber Security / Reverse","ident_utf16":{"start":{"line_number":3345,"utf16_col":4},"end":{"line_number":3345,"utf16_col":28}},"extent_utf16":{"start":{"line_number":3345,"utf16_col":0},"end":{"line_number":3355,"utf16_col":0}}},{"name":"Embedded / IoT","kind":"section_3","ident_start":160910,"ident_end":160924,"extent_start":160906,"extent_end":161289,"fully_qualified_name":"Embedded / IoT","ident_utf16":{"start":{"line_number":3355,"utf16_col":4},"end":{"line_number":3355,"utf16_col":18}},"extent_utf16":{"start":{"line_number":3355,"utf16_col":0},"end":{"line_number":3364,"utf16_col":0}}},{"name":"Audio / Video / Streaming / SDK","kind":"section_3","ident_start":161293,"ident_end":161324,"extent_start":161289,"extent_end":161823,"fully_qualified_name":"Audio / Video / Streaming / SDK","ident_utf16":{"start":{"line_number":3364,"utf16_col":4},"end":{"line_number":3364,"utf16_col":35}},"extent_utf16":{"start":{"line_number":3364,"utf16_col":0},"end":{"line_number":3374,"utf16_col":0}}},{"name":"Computer Vision / Machine Learning","kind":"section_3","ident_start":161827,"ident_end":161861,"extent_start":161823,"extent_end":162754,"fully_qualified_name":"Computer Vision / Machine Learning","ident_utf16":{"start":{"line_number":3374,"utf16_col":4},"end":{"line_number":3374,"utf16_col":38}},"extent_utf16":{"start":{"line_number":3374,"utf16_col":0},"end":{"line_number":3385,"utf16_col":0}}},{"name":"💯 Review brush question website","kind":"section_2","ident_start":162757,"ident_end":162791,"extent_start":162754,"extent_end":163167,"fully_qualified_name":"💯 Review brush question website","ident_utf16":{"start":{"line_number":3385,"utf16_col":3},"end":{"line_number":3385,"utf16_col":35}},"extent_utf16":{"start":{"line_number":3385,"utf16_col":0},"end":{"line_number":3396,"utf16_col":0}}},{"name":"📝 Interview Question Experience","kind":"section_2","ident_start":163170,"ident_end":163204,"extent_start":163167,"extent_end":165324,"fully_qualified_name":"📝 Interview Question Experience","ident_utf16":{"start":{"line_number":3396,"utf16_col":3},"end":{"line_number":3396,"utf16_col":35}},"extent_utf16":{"start":{"line_number":3396,"utf16_col":0},"end":{"line_number":3419,"utf16_col":0}}},{"name":"📆 Recruiting time posts","kind":"section_2","ident_start":165327,"ident_end":165353,"extent_start":165324,"extent_end":165469,"fully_qualified_name":"📆 Recruiting time posts","ident_utf16":{"start":{"line_number":3419,"utf16_col":3},"end":{"line_number":3419,"utf16_col":27}},"extent_utf16":{"start":{"line_number":3419,"utf16_col":0},"end":{"line_number":3425,"utf16_col":0}}},{"name":"👍 Recommend","kind":"section_2","ident_start":165472,"ident_end":165486,"extent_start":165469,"extent_end":166005,"fully_qualified_name":"👍 Recommend","ident_utf16":{"start":{"line_number":3425,"utf16_col":3},"end":{"line_number":3425,"utf16_col":15}},"extent_utf16":{"start":{"line_number":3425,"utf16_col":0},"end":{"line_number":3432,"utf16_col":0}}},{"name":"👬 Contributor","kind":"section_2","ident_start":166008,"ident_end":166024,"extent_start":166005,"extent_end":166200,"fully_qualified_name":"👬 Contributor","ident_utf16":{"start":{"line_number":3432,"utf16_col":3},"end":{"line_number":3432,"utf16_col":17}},"extent_utf16":{"start":{"line_number":3432,"utf16_col":0},"end":{"line_number":3438,"utf16_col":0}}},{"name":"📜 License","kind":"section_2","ident_start":166203,"ident_end":166215,"extent_start":166200,"extent_end":166550,"fully_qualified_name":"📜 License","ident_utf16":{"start":{"line_number":3438,"utf16_col":3},"end":{"line_number":3438,"utf16_col":13}},"extent_utf16":{"start":{"line_number":3438,"utf16_col":0},"end":{"line_number":3443,"utf16_col":0}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"csrf_tokens":{"/huihut/interview/branches":{"post":"lun2Yyl7g7umG7_R9FiXDh0f9OVy_h5QGbrOe7RtJJ1RAQxEacbcPtraag8KGDiwomK9EwdyyTeNi3BFlzZLmA"},"/repos/preferences":{"post":"iD3JHSftmGW6eVGIZlBIoanm6cIgb2UR-Nzri_CSF18ZIGZpdc-rSG9zHZQaRM0KXTg9vmVFGP7X1jnYxIuNFg"}}},"title":"interview/README_en.md at master · huihut/interview","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-9f8a877aa99f.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-96e76d5fdb2c.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"overview_shared_code_dropdown_button":false,"react_blob_overlay":false,"copilot_conversational_ux_embedding_update":false,"copilot_smell_icebreaker_ux":true,"accessible_code_button":true}}}</script> <div data-target="react-app.reactRoot"><style data-styled="true" data-styled-version="5.3.11">.hOfjFo{padding:0;}/*!sc*/ .oDGAe{max-width:100%;margin-left:auto;margin-right:auto;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}/*!sc*/ .kowOcT{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1 1 100%;-ms-flex:1 1 100%;flex:1 1 100%;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;}/*!sc*/ .gISSDQ{width:100%;}/*!sc*/ @media screen and (min-width:544px){.gISSDQ{width:100%;}}/*!sc*/ @media screen and (min-width:768px){.gISSDQ{width:auto;}}/*!sc*/ .cEmWSE{display:none;-webkit-order:1;-ms-flex-order:1;order:1;width:100%;margin-left:0;margin-right:0;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;margin-bottom:0;min-width:0;}/*!sc*/ @media screen and (min-width:768px){.cEmWSE{width:auto;margin-top:0 !important;margin-bottom:0 !important;position:-webkit-sticky;position:sticky;top:0px;max-height:100vh !important;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;margin-right:0;height:100vh;}}/*!sc*/ @media print,screen and (max-width:1011px) and (min-width:768px){.cEmWSE{display:none;}}/*!sc*/ .hPvFuC{margin-left:0;margin-right:0;display:none;margin-top:0;}/*!sc*/ @media screen and (min-width:768px){.hPvFuC{margin-left:0 !important;margin-right:0 !important;}}/*!sc*/ .fFSoPl{--pane-min-width:256px;--pane-max-width-diff:511px;--pane-max-width:calc(100vw - var(--pane-max-width-diff));width:100%;padding:0;}/*!sc*/ @media screen and (min-width:544px){}/*!sc*/ @media screen and (min-width:768px){.fFSoPl{width:clamp(var(--pane-min-width),var(--pane-width),var(--pane-max-width));overflow:auto;}}/*!sc*/ @media screen and (min-width:1280px){.fFSoPl{--pane-max-width-diff:959px;}}/*!sc*/ .bTBnTW{height:100%;position:relative;display:none;margin-left:0;}/*!sc*/ .bHLmSv{position:absolute;inset:0 -2px;cursor:col-resize;background-color:transparent;-webkit-transition-delay:0.1s;transition-delay:0.1s;}/*!sc*/ .bHLmSv:hover{background-color:var(--bgColor-neutral-muted,var(--color-neutral-muted,rgba(175,184,193,0.2)));}/*!sc*/ .iKqMNA{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-order:2;-ms-flex-order:2;order:2;-webkit-flex-basis:0;-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;min-width:1px;margin-right:auto;}/*!sc*/ @media print{.iKqMNA{display:-webkit-box !important;display:-webkit-flex !important;display:-ms-flexbox !important;display:flex !important;}}/*!sc*/ .FxAyp{width:100%;max-width:100%;margin-left:auto;margin-right:auto;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:0;}/*!sc*/ .leYMvG{margin-left:auto;margin-right:auto;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;padding-bottom:40px;max-width:100%;margin-top:0;}/*!sc*/ .KMPzq{display:inherit;}/*!sc*/ .hfKjHv{width:100%;}/*!sc*/ .gZWyZE{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:8px;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:100%;}/*!sc*/ .dwYKDk{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;gap:8px;}/*!sc*/ .ibcGmb{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;min-width:0;}/*!sc*/ .hKaEJF{display:block;margin-right:8px;}/*!sc*/ @media screen and (min-width:1360px){.hKaEJF{display:block;}}/*!sc*/ .XosP{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;font-size:14px;}/*!sc*/ .bCKfWo[data-size="medium"]{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));padding-left:8px;padding-right:8px;display:none;}/*!sc*/ @media screen and (max-width:768px){.bCKfWo[data-size="medium"]{display:block;}}/*!sc*/ .gUkoLg{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}/*!sc*/ .dmxRgG[data-size="medium"]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ .dmxRgG[data-size="medium"] svg{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .dmxRgG[data-size="medium"] > span{width:inherit;}/*!sc*/ .bZBlpz{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;width:100%;}/*!sc*/ .lhTYNA{margin-right:4px;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .dbrgmi{font-size:14px;min-width:0;max-width:125px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}/*!sc*/ .dHJiml{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding-left:8px;padding-right:8px;min-width:0;}/*!sc*/ .cEytCf{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;font-size:16px;min-width:0;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .fzFXnm{max-width:100%;}/*!sc*/ .iMnkmv{max-width:100%;list-style:none;display:inline-block;}/*!sc*/ .ghzDag{display:inline-block;max-width:100%;}/*!sc*/ .kHuKdh{font-weight:600;}/*!sc*/ .jGhzSQ{font-weight:600;display:inline-block;max-width:100%;font-size:16px;}/*!sc*/ .faNtbn{min-height:32px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;}/*!sc*/ .fmQaBv{margin-left:4px;margin-right:4px;}/*!sc*/ .dwNhzn[data-size="medium"][data-no-visuals]{border-top-left-radius:0;border-bottom-left-radius:0;display:none;}/*!sc*/ .fGwBZA[data-size="medium"][data-no-visuals]{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .dJxjrT{margin-left:16px;margin-right:16px;}/*!sc*/ .eFxKDQ{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}/*!sc*/ .dzCJzi{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;min-width:273px;padding:8px;}/*!sc*/ @media screen and (min-width:544px){.dzCJzi{-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;}}/*!sc*/ .ldRxiI{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}/*!sc*/ .fVkfyA{width:100%;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;min-width:0;margin-right:0;}/*!sc*/ .gNAmSV{height:40px;padding-left:4px;padding-bottom:16px;}/*!sc*/ .jNEwzY{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .bsDwxw{font-size:12px;-webkit-flex:auto;-ms-flex:auto;flex:auto;padding-right:16px;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));min-width:0;}/*!sc*/ .jdLMhu{top:0px;z-index:4;background:var(--bgColor-default,var(--color-canvas-default));position:-webkit-sticky;position:sticky;}/*!sc*/ .tOISc{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:100%;position:absolute;}/*!sc*/ .hqwSEx{display:none;min-width:0;padding-top:8px;padding-bottom:8px;}/*!sc*/ .bDVoEr{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;overflow:hidden;margin-left:8px;margin-right:8px;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;width:100%;}/*!sc*/ .kYLlPM{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .gYjEmn{margin-left:4px;margin-right:8px;}/*!sc*/ .kGqOLL{text-overflow:ellipsis;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}/*!sc*/ .fHind{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;font-size:14px;min-width:0;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}/*!sc*/ .dnZoUW{font-weight:600;display:inline-block;max-width:100%;font-size:14px;}/*!sc*/ .jRZWlf[data-size="small"]{color:var(--fgColor-default,var(--color-fg-default,#1F2328));margin-left:8px;}/*!sc*/ .kTvpNk{padding-left:8px;padding-top:8px;padding-bottom:8px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;background-color:var(--bgColor-muted,var(--color-canvas-subtle,#f6f8fa));border:1px solid var(--borderColor-default,var(--color-border-default));border-radius:6px 6px 0px 0px;}/*!sc*/ .iNMjfP{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;min-width:0;}/*!sc*/ .fefCSX{display:block;position:relative;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;margin-top:-1px;margin-bottom:-1px;--separator-color:transparent;}/*!sc*/ .fefCSX:not(:last-child){margin-right:1px;}/*!sc*/ .fefCSX:not(:last-child):after{background-color:var(--separator-color);content:"";position:absolute;right:-2px;top:8px;bottom:8px;width:1px;}/*!sc*/ .fefCSX:focus-within:has(:focus-visible){--separator-color:transparent;}/*!sc*/ .fefCSX:first-child{margin-left:-1px;}/*!sc*/ .fefCSX:last-child{margin-right:-1px;}/*!sc*/ .idgUkN{display:block;position:relative;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;margin-top:-1px;margin-bottom:-1px;--separator-color:var(--borderColor-default,var(--color-border-default,#d0d7de));}/*!sc*/ .idgUkN:not(:last-child){margin-right:1px;}/*!sc*/ .idgUkN:not(:last-child):after{background-color:var(--separator-color);content:"";position:absolute;right:-2px;top:8px;bottom:8px;width:1px;}/*!sc*/ .idgUkN:focus-within:has(:focus-visible){--separator-color:transparent;}/*!sc*/ .idgUkN:first-child{margin-left:-1px;}/*!sc*/ .idgUkN:last-child{margin-right:-1px;}/*!sc*/ .kcLCKF{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;margin-right:8px;}/*!sc*/ .kVWtTz{gap:8px;}/*!sc*/ .gWqxTd{padding-left:8px;padding-right:8px;}/*!sc*/ .gWqxTd linkButtonSx:hover:not([disabled]){-webkit-text-decoration:none;text-decoration:none;}/*!sc*/ .gWqxTd linkButtonSx:focus:not([disabled]){-webkit-text-decoration:none;text-decoration:none;}/*!sc*/ .gWqxTd linkButtonSx:active:not([disabled]){-webkit-text-decoration:none;text-decoration:none;}/*!sc*/ .ivobqY[data-size="small"][data-no-visuals]{border-top-left-radius:0;border-bottom-left-radius:0;}/*!sc*/ .iNRSob[data-size="small"][data-no-visuals]{color:var(--fgColor-muted,var(--color-fg-muted));margin-right:8px;}/*!sc*/ .ffkqe[data-size="small"][data-no-visuals]{color:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .hGyMdv{border:1px solid;border-top:none;border-color:var(--borderColor-default,var(--color-border-default,#d0d7de));border-radius:0px 0px 6px 6px;min-width:273px;}/*!sc*/ .fGqKFv{background-color:var(--bgColor-default,var(--color-canvas-default));border:0px;border-width:0;border-radius:0px 0px 6px 6px;padding:0;min-width:0;margin-top:46px;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}/*!sc*/ .eoaCFS{border-bottom-left-radius:6px;border-bottom-right-radius:6px;padding:32px;min-width:0;}/*!sc*/ .cCoXib{position:fixed;top:0;right:0;height:100%;width:15px;-webkit-transition:-webkit-transform 0.3s;-webkit-transition:transform 0.3s;transition:transform 0.3s;z-index:1;}/*!sc*/ .cCoXib:hover{-webkit-transform:scaleX(1.5);-ms-transform:scaleX(1.5);transform:scaleX(1.5);}/*!sc*/ data-styled.g1[id="Box-sc-g0xbh4-0"]{content:"hOfjFo,oDGAe,kowOcT,gISSDQ,cEmWSE,hPvFuC,fFSoPl,bTBnTW,bHLmSv,iKqMNA,FxAyp,leYMvG,KMPzq,hfKjHv,gZWyZE,dwYKDk,ibcGmb,hKaEJF,XosP,bCKfWo,gUkoLg,dmxRgG,bZBlpz,lhTYNA,dbrgmi,dHJiml,cEytCf,fzFXnm,iMnkmv,ghzDag,kHuKdh,jGhzSQ,faNtbn,fmQaBv,dwNhzn,fGwBZA,dJxjrT,eFxKDQ,dzCJzi,ldRxiI,fVkfyA,gNAmSV,jNEwzY,bsDwxw,jdLMhu,tOISc,hqwSEx,bDVoEr,kYLlPM,gYjEmn,kGqOLL,fHind,dnZoUW,jRZWlf,kTvpNk,iNMjfP,fefCSX,idgUkN,kcLCKF,kVWtTz,gWqxTd,ivobqY,iNRSob,ffkqe,hGyMdv,fGqKFv,eoaCFS,cCoXib,"}/*!sc*/ .eMMFM{min-width:0;}/*!sc*/ .eMMFM:where([data-size='small']){font-size:var(--text-body-size-small,0.75rem);line-height:var(--text-body-lineHeight-small,1.6666);}/*!sc*/ .eMMFM:where([data-size='medium']){font-size:var(--text-body-size-medium,0.875rem);line-height:var(--text-body-lineHeight-medium,1.4285);}/*!sc*/ .eMMFM:where([data-size='large']){font-size:var(--text-body-size-large,1rem);line-height:var(--text-body-lineHeight-large,1.5);}/*!sc*/ .eMMFM:where([data-weight='light']){font-weight:var(--base-text-weight-light,300);}/*!sc*/ .eMMFM:where([data-weight='normal']){font-weight:var(--base-text-weight-normal,400);}/*!sc*/ .eMMFM:where([data-weight='medium']){font-weight:var(--base-text-weight-medium,500);}/*!sc*/ .eMMFM:where([data-weight='semibold']){font-weight:var(--base-text-weight-semibold,600);}/*!sc*/ .HlHVj{padding-left:4px;padding-right:4px;font-weight:400;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));font-size:16px;}/*!sc*/ .HlHVj:where([data-size='small']){font-size:var(--text-body-size-small,0.75rem);line-height:var(--text-body-lineHeight-small,1.6666);}/*!sc*/ .HlHVj:where([data-size='medium']){font-size:var(--text-body-size-medium,0.875rem);line-height:var(--text-body-lineHeight-medium,1.4285);}/*!sc*/ .HlHVj:where([data-size='large']){font-size:var(--text-body-size-large,1rem);line-height:var(--text-body-lineHeight-large,1.5);}/*!sc*/ .HlHVj:where([data-weight='light']){font-weight:var(--base-text-weight-light,300);}/*!sc*/ .HlHVj:where([data-weight='normal']){font-weight:var(--base-text-weight-normal,400);}/*!sc*/ .HlHVj:where([data-weight='medium']){font-weight:var(--base-text-weight-medium,500);}/*!sc*/ .HlHVj:where([data-weight='semibold']){font-weight:var(--base-text-weight-semibold,600);}/*!sc*/ .lauzFl{padding-left:4px;padding-right:4px;font-weight:400;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));font-size:14px;}/*!sc*/ .lauzFl:where([data-size='small']){font-size:var(--text-body-size-small,0.75rem);line-height:var(--text-body-lineHeight-small,1.6666);}/*!sc*/ .lauzFl:where([data-size='medium']){font-size:var(--text-body-size-medium,0.875rem);line-height:var(--text-body-lineHeight-medium,1.4285);}/*!sc*/ .lauzFl:where([data-size='large']){font-size:var(--text-body-size-large,1rem);line-height:var(--text-body-lineHeight-large,1.5);}/*!sc*/ .lauzFl:where([data-weight='light']){font-weight:var(--base-text-weight-light,300);}/*!sc*/ .lauzFl:where([data-weight='normal']){font-weight:var(--base-text-weight-normal,400);}/*!sc*/ .lauzFl:where([data-weight='medium']){font-weight:var(--base-text-weight-medium,500);}/*!sc*/ .lauzFl:where([data-weight='semibold']){font-weight:var(--base-text-weight-semibold,600);}/*!sc*/ data-styled.g3[id="Text__StyledText-sc-17v1xeu-0"]{content:"eMMFM,HlHVj,lauzFl,"}/*!sc*/ .jkNcAv{border:0;font-size:inherit;font-family:inherit;background-color:transparent;-webkit-appearance:none;color:inherit;width:100%;}/*!sc*/ .jkNcAv:focus{outline:0;}/*!sc*/ data-styled.g13[id="UnstyledTextInput__ToggledUnstyledTextInput-sc-14ypya-0"]{content:"jkNcAv,"}/*!sc*/ .hLzFvi{font-size:14px;line-height:var(--base-size-20);color:var(--fgColor-default,var(--color-fg-default,#1F2328));vertical-align:middle;background-color:var(--bgColor-default,var(--color-canvas-default,#ffffff));border:1px solid var(--control-borderColor-rest,var(--borderColor-default,var(--color-border-default,#d0d7de)));border-radius:6px;outline:none;box-shadow:var(--shadow-inset,var(--color-primer-shadow-inset,inset 0 1px 0 rgba(208,215,222,0.2)));display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;min-height:var(--base-size-32);overflow:hidden;--inner-action-size:var(--base-size-24);}/*!sc*/ .hLzFvi input,.hLzFvi textarea{cursor:text;}/*!sc*/ .hLzFvi select{cursor:pointer;}/*!sc*/ .hLzFvi input::-webkit-input-placeholder,.hLzFvi textarea::-webkit-input-placeholder,.hLzFvi select::-webkit-input-placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi input::-moz-placeholder,.hLzFvi textarea::-moz-placeholder,.hLzFvi select::-moz-placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi input:-ms-input-placeholder,.hLzFvi textarea:-ms-input-placeholder,.hLzFvi select:-ms-input-placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi input::placeholder,.hLzFvi textarea::placeholder,.hLzFvi select::placeholder{color:var(---control-fgColor-placeholder,var(--fgColor-muted,var(--color-fg-muted,#656d76)));}/*!sc*/ .hLzFvi:where([data-trailing-action][data-focused]),.hLzFvi:where(:not([data-trailing-action]):focus-within){border-color:var(--fgColor-accent,var(--color-accent-fg,#0969da));outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .hLzFvi > textarea{padding:var(--base-size-12);}/*!sc*/ .hLzFvi:where([data-contrast]){background-color:var(--bgColor-inset,var(--color-canvas-inset,#f6f8fa));}/*!sc*/ .hLzFvi:where([data-disabled]){color:var(--fgColor-disabled,var(--color-primer-fg-disabled,#8c959f));background-color:var(--control-bgColor-disabled,var(--color-input-disabled-bg,rgba(175,184,193,0.2)));box-shadow:none;border-color:var(--control-borderColor-disabled,var(--borderColor-default,var(--color-border-default,#d0d7de)));}/*!sc*/ .hLzFvi:where([data-disabled]) input,.hLzFvi:where([data-disabled]) textarea,.hLzFvi:where([data-disabled]) select{cursor:not-allowed;}/*!sc*/ .hLzFvi:where([data-monospace]){font-family:var(--fontStack-monospace,SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace);}/*!sc*/ .hLzFvi:where([data-validation='error']){border-color:var(--borderColor-danger-emphasis,var(--color-danger-emphasis,#cf222e));}/*!sc*/ .hLzFvi:where([data-validation='error']):where([data-trailing-action][data-focused]),.hLzFvi:where([data-validation='error']):where(:not([data-trailing-action])):focus-within{border-color:var(--fgColor-accent,var(--color-accent-fg,#0969da));outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .hLzFvi:where([data-validation='success']){border-color:var(--bgColor-success-emphasis,var(--color-success-emphasis,#1f883d));}/*!sc*/ .hLzFvi:where([data-block]){width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;}/*!sc*/ @media (min-width:768px){.hLzFvi{font-size:var(--text-body-size-medium);}}/*!sc*/ .hLzFvi:where([data-size='small']){--inner-action-size:var(--base-size-20);min-height:var(--base-size-28);padding-top:3px;padding-right:var(--base-size-8);padding-bottom:3px;padding-left:var(--base-size-8);font-size:var(--text-body-size-small);line-height:var(--base-size-20);}/*!sc*/ .hLzFvi:where([data-size='large']){--inner-action-size:var(--base-size-28);height:var(--base-size-40);padding-top:10px;padding-right:var(--base-size-8);padding-bottom:10px;padding-left:var(--base-size-8);}/*!sc*/ .hLzFvi:where([data-variant='small']){min-height:28px;padding-top:3px;padding-right:var(--base-size-8);padding-bottom:3px;padding-left:var(--base-size-8);font-size:(--text-body-size-small);line-height:var(--base-size-20);}/*!sc*/ .hLzFvi:where([data-variant='large']){padding-top:10px;padding-right:var(--base-size-8);padding-bottom:10px;padding-left:var(--base-size-8);font-size:var(--text-title-size-medium);}/*!sc*/ .hLzFvi{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-width:160px;}/*!sc*/ data-styled.g14[id="TextInputWrapper__StyledTextInputBaseWrapper-sc-1mqhpbi-0"]{content:"hLzFvi,"}/*!sc*/ .iHYdQq{background-repeat:no-repeat;background-position:right 8px center;padding-right:0;padding-left:0;}/*!sc*/ .iHYdQq > :not(:last-child){margin-right:8px;}/*!sc*/ .iHYdQq .TextInput-icon,.iHYdQq .TextInput-action{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;color:var(--fgColor-muted,var(--color-fg-muted,#656d76));-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}/*!sc*/ .iHYdQq > input,.iHYdQq > select{padding-right:0;padding-left:0;}/*!sc*/ .iHYdQq:where([data-leading-visual]){padding-left:var(--base-size-12);}/*!sc*/ .iHYdQq:where([data-trailing-visual]:not([data-trailing-action])){padding-right:var(--base-size-12);}/*!sc*/ .iHYdQq:where(:not([data-leading-visual])) > input,.iHYdQq:where(:not([data-leading-visual])) > select{padding-left:var(--base-size-12);}/*!sc*/ .iHYdQq:where(:not([data-trailing-visual]):not([data-trailing-action])) > input,.iHYdQq:where(:not([data-trailing-visual]):not([data-trailing-action])) > select{padding-right:var(--base-size-12);}/*!sc*/ .iHYdQq{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-width:160px;}/*!sc*/ data-styled.g15[id="TextInputWrapper__StyledTextInputWrapper-sc-1mqhpbi-1"]{content:"iHYdQq,"}/*!sc*/ .jOyaRH{display:none;}/*!sc*/ .jOyaRH[popover]{position:absolute;padding:0.5em 0.75em;width:-webkit-max-content;width:-moz-max-content;width:max-content;margin:auto;-webkit-clip:auto;clip:auto;white-space:normal;font:normal normal 11px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";-webkit-font-smoothing:subpixel-antialiased;color:var(--tooltip-fgColor,var(--fgColor-onEmphasis,var(--color-fg-on-emphasis,#ffffff)));text-align:center;word-wrap:break-word;background:var(--tooltip-bgColor,var(--bgColor-emphasis,var(--color-neutral-emphasis-plus,#24292f)));border-radius:6px;border:0;opacity:0;max-width:250px;inset:auto;overflow:visible;}/*!sc*/ .jOyaRH[popover]:popover-open{display:block;}/*!sc*/ .jOyaRH[popover].\:popover-open{display:block;}/*!sc*/ @media (forced-colors:active){.jOyaRH{outline:1px solid transparent;}}/*!sc*/ .jOyaRH::after{position:absolute;display:block;right:0;left:0;height:var(--overlay-offset,0.25rem);content:'';}/*!sc*/ .jOyaRH[data-direction='n']::after,.jOyaRH[data-direction='ne']::after,.jOyaRH[data-direction='nw']::after{top:100%;}/*!sc*/ .jOyaRH[data-direction='s']::after,.jOyaRH[data-direction='se']::after,.jOyaRH[data-direction='sw']::after{bottom:100%;}/*!sc*/ .jOyaRH[data-direction='w']::after{position:absolute;display:block;height:100%;width:8px;content:'';bottom:0;left:100%;}/*!sc*/ .jOyaRH[data-direction='e']::after{position:absolute;display:block;height:100%;width:8px;content:'';bottom:0;right:100%;margin-left:-8px;}/*!sc*/ @-webkit-keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ @keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ .jOyaRH:popover-open,.jOyaRH:popover-open::before{-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .jOyaRH.\:popover-open,.jOyaRH.\:popover-open::before{-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ data-styled.g16[id="Tooltip__StyledTooltip-sc-e45c7z-0"]{content:"jOyaRH,"}/*!sc*/ .hWlpPn{position:relative;display:inline-block;}/*!sc*/ .hWlpPn::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";-webkit-font-smoothing:subpixel-antialiased;color:var(--tooltip-fgColor,var(--fgColor-onEmphasis,var(--color-fg-on-emphasis,#ffffff)));text-align:center;-webkit-text-decoration:none;text-decoration:none;text-shadow:none;text-transform:none;-webkit-letter-spacing:normal;-moz-letter-spacing:normal;-ms-letter-spacing:normal;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:var(--tooltip-bgColor,var(--bgColor-emphasis,var(--color-neutral-emphasis-plus,#24292f)));border-radius:6px;opacity:0;}/*!sc*/ @-webkit-keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ @keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}/*!sc*/ .hWlpPn:hover::after,.hWlpPn:active::after,.hWlpPn:focus::after,.hWlpPn:focus-within::after{display:inline-block;-webkit-text-decoration:none;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:0.1s;animation-duration:0.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .hWlpPn.tooltipped-no-delay:hover::after,.hWlpPn.tooltipped-no-delay:active::after,.hWlpPn.tooltipped-no-delay:focus::after,.hWlpPn.tooltipped-no-delay:focus-within::after{-webkit-animation-delay:0s;animation-delay:0s;}/*!sc*/ .hWlpPn.tooltipped-multiline:hover::after,.hWlpPn.tooltipped-multiline:active::after,.hWlpPn.tooltipped-multiline:focus::after,.hWlpPn.tooltipped-multiline:focus-within::after{display:table-cell;}/*!sc*/ .hWlpPn.tooltipped-s::after,.hWlpPn.tooltipped-se::after,.hWlpPn.tooltipped-sw::after{top:100%;right:50%;margin-top:6px;}/*!sc*/ .hWlpPn.tooltipped-se::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .hWlpPn.tooltipped-sw::after{margin-right:-16px;}/*!sc*/ .hWlpPn.tooltipped-n::after,.hWlpPn.tooltipped-ne::after,.hWlpPn.tooltipped-nw::after{right:50%;bottom:100%;margin-bottom:6px;}/*!sc*/ .hWlpPn.tooltipped-ne::after{right:auto;left:50%;margin-left:-16px;}/*!sc*/ .hWlpPn.tooltipped-nw::after{margin-right:-16px;}/*!sc*/ .hWlpPn.tooltipped-s::after,.hWlpPn.tooltipped-n::after{-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);}/*!sc*/ .hWlpPn.tooltipped-w::after{right:100%;bottom:50%;margin-right:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .hWlpPn.tooltipped-e::after{bottom:50%;left:100%;margin-left:6px;-webkit-transform:translateY(50%);-ms-transform:translateY(50%);transform:translateY(50%);}/*!sc*/ .hWlpPn.tooltipped-multiline::after{width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}/*!sc*/ .hWlpPn.tooltipped-multiline.tooltipped-s::after,.hWlpPn.tooltipped-multiline.tooltipped-n::after{right:auto;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);}/*!sc*/ .hWlpPn.tooltipped-multiline.tooltipped-w::after,.hWlpPn.tooltipped-multiline.tooltipped-e::after{right:100%;}/*!sc*/ .hWlpPn.tooltipped-align-right-2::after{right:0;margin-right:0;}/*!sc*/ .hWlpPn.tooltipped-align-left-2::after{left:0;margin-left:0;}/*!sc*/ data-styled.g17[id="Tooltip__TooltipBase-sc-17tf59c-0"]{content:"hWlpPn,"}/*!sc*/ .eAtkQz{display:inline-block;overflow:hidden;text-overflow:ellipsis;vertical-align:top;white-space:nowrap;max-width:125px;max-width:100%;}/*!sc*/ data-styled.g19[id="Truncate__StyledTruncate-sc-23o1d2-0"]{content:"eAtkQz,"}/*!sc*/ .dwImxt{--segmented-control-button-inner-padding:12px;--segmented-control-button-bg-inset:4px;--segmented-control-outer-radius:6px;background-color:transparent;border-color:transparent;border-radius:var(--segmented-control-outer-radius);border-width:0;color:currentColor;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:600;padding:0;height:100%;width:100%;}/*!sc*/ .dwImxt:focus:not(:disabled){box-shadow:none;outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .dwImxt:focus:not(:disabled):not(:focus-visible){outline:solid 1px transparent;}/*!sc*/ .dwImxt:focus-visible:not(:disabled){box-shadow:none;outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .dwImxt .segmentedControl-content{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--controlKnob-bgColor-rest,var(--color-segmented-control-button-bg,#ffffff));border-color:var(--controlKnob-borderColor-rest,var(--color-segmented-control-button-hover-active-selected-border,#8c959f));border-style:solid;border-width:1px;border-radius:var(--segmented-control-outer-radius);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;padding-left:var(--segmented-control-button-inner-padding);padding-right:var(--segmented-control-button-inner-padding);}/*!sc*/ .dwImxt svg{fill:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .dwImxt:focus:focus-visible:not(:last-child):after{width:0;}/*!sc*/ .dwImxt .segmentedControl-text:after{content:"Preview";display:block;font-weight:600;height:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;visibility:hidden;}/*!sc*/ @media (pointer:coarse){.dwImxt:before{content:"";position:absolute;left:0;right:0;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);top:50%;min-height:44px;}}/*!sc*/ .iFTkun{--segmented-control-button-inner-padding:12px;--segmented-control-button-bg-inset:4px;--segmented-control-outer-radius:6px;background-color:transparent;border-color:transparent;border-radius:var(--segmented-control-outer-radius);border-width:0;color:currentColor;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:400;padding:var(--segmented-control-button-bg-inset);height:100%;width:100%;}/*!sc*/ .iFTkun:focus:not(:disabled){box-shadow:none;outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .iFTkun:focus:not(:disabled):not(:focus-visible){outline:solid 1px transparent;}/*!sc*/ .iFTkun:focus-visible:not(:disabled){box-shadow:none;outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .iFTkun .segmentedControl-content{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:transparent;border-color:transparent;border-style:solid;border-width:1px;border-radius:calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;padding-left:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));padding-right:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));}/*!sc*/ .iFTkun svg{fill:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .iFTkun:hover .segmentedControl-content{background-color:var(--controlTrack-bgColor-hover,var(--color-segmented-control-button-hover-bg,rgba(175,184,193,0.2)));}/*!sc*/ .iFTkun:active .segmentedControl-content{background-color:var(--controlTrack-bgColor-active,var(--color-segmented-control-button-hover-active-bg,rgba(175,184,193,0.4)));}/*!sc*/ .iFTkun:focus:focus-visible:not(:last-child):after{width:0;}/*!sc*/ .iFTkun .segmentedControl-text:after{content:"Code";display:block;font-weight:600;height:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;visibility:hidden;}/*!sc*/ @media (pointer:coarse){.iFTkun:before{content:"";position:absolute;left:0;right:0;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);top:50%;min-height:44px;}}/*!sc*/ .bHmvop{--segmented-control-button-inner-padding:12px;--segmented-control-button-bg-inset:4px;--segmented-control-outer-radius:6px;background-color:transparent;border-color:transparent;border-radius:var(--segmented-control-outer-radius);border-width:0;color:currentColor;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:400;padding:var(--segmented-control-button-bg-inset);height:100%;width:100%;}/*!sc*/ .bHmvop:focus:not(:disabled){box-shadow:none;outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .bHmvop:focus:not(:disabled):not(:focus-visible){outline:solid 1px transparent;}/*!sc*/ .bHmvop:focus-visible:not(:disabled){box-shadow:none;outline:2px solid var(--fgColor-accent,var(--color-accent-fg,#0969da));outline-offset:-1px;}/*!sc*/ .bHmvop .segmentedControl-content{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:transparent;border-color:transparent;border-style:solid;border-width:1px;border-radius:calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;padding-left:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));padding-right:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));}/*!sc*/ .bHmvop svg{fill:var(--fgColor-muted,var(--color-fg-muted,#656d76));}/*!sc*/ .bHmvop:hover .segmentedControl-content{background-color:var(--controlTrack-bgColor-hover,var(--color-segmented-control-button-hover-bg,rgba(175,184,193,0.2)));}/*!sc*/ .bHmvop:active .segmentedControl-content{background-color:var(--controlTrack-bgColor-active,var(--color-segmented-control-button-hover-active-bg,rgba(175,184,193,0.4)));}/*!sc*/ .bHmvop:focus:focus-visible:not(:last-child):after{width:0;}/*!sc*/ .bHmvop .segmentedControl-text:after{content:"Blame";display:block;font-weight:600;height:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;visibility:hidden;}/*!sc*/ @media (pointer:coarse){.bHmvop:before{content:"";position:absolute;left:0;right:0;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);top:50%;min-height:44px;}}/*!sc*/ data-styled.g105[id="SegmentedControlButton__SegmentedControlButtonStyled-sc-8lkgxl-0"]{content:"dwImxt,iFTkun,bHmvop,"}/*!sc*/ .lawgDG{background-color:var(--controlTrack-bgColor-rest,var(--color-segmented-control-bg,#eaeef2));border-radius:6px;border:1px solid;border-color:var(--controlTrack-borderColor-rest,transparent);display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;font-size:14px;height:28px;margin:0;padding:0;}/*!sc*/ data-styled.g107[id="SegmentedControl__SegmentedControlList-sc-1rzig82-0"]{content:"lawgDG,"}/*!sc*/ body[data-page-layout-dragging="true"]{cursor:col-resize;}/*!sc*/ body[data-page-layout-dragging="true"] *{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}/*!sc*/ data-styled.g108[id="sc-global-gbKrvU1"]{content:"sc-global-gbKrvU1,"}/*!sc*/ </style><meta data-hydrostats="publish"/> <!-- --> <!-- --> <button hidden="" data-testid="header-permalink-button" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden=""></button><div><div style="--sticky-pane-height:100vh;--spacing:var(--spacing-none)" class="Box-sc-g0xbh4-0 hOfjFo"><div class="Box-sc-g0xbh4-0 oDGAe"><div class="Box-sc-g0xbh4-0 kowOcT"><div tabindex="0" class="Box-sc-g0xbh4-0 gISSDQ"><div class="Box-sc-g0xbh4-0 cEmWSE"><div class="Box-sc-g0xbh4-0 hPvFuC"></div><div style="--pane-width:320px" class="Box-sc-g0xbh4-0 fFSoPl"></div><div class="Box-sc-g0xbh4-0 bTBnTW"><div role="slider" aria-label="Draggable pane splitter" aria-valuemin="0" aria-valuemax="0" aria-valuenow="0" aria-valuetext="Pane width 0 pixels" tabindex="0" class="Box-sc-g0xbh4-0 bHLmSv"></div></div></div></div><div class="Box-sc-g0xbh4-0 iKqMNA"><div class="Box-sc-g0xbh4-0"></div><div class="Box-sc-g0xbh4-0 FxAyp"><div data-selector="repos-split-pane-content" tabindex="0" class="Box-sc-g0xbh4-0 leYMvG"><div class="Box-sc-g0xbh4-0 KMPzq"><div class="Box-sc-g0xbh4-0 hfKjHv container"><div class="px-3 pt-3 pb-0" id="StickyHeader"><div class="Box-sc-g0xbh4-0 gZWyZE"><div class="Box-sc-g0xbh4-0 dwYKDk"><div class="Box-sc-g0xbh4-0 ibcGmb react-code-view-header-wrap--narrow"><div class="Box-sc-g0xbh4-0 hKaEJF"><h2 class="Box-sc-g0xbh4-0 XosP prc-Heading-Heading-6CmGO"><button style="--button-color:fg.muted" type="button" aria-label="Expand file tree" data-testid="expand-file-tree-button-mobile" class="Box-sc-g0xbh4-0 bCKfWo prc-Button-ButtonBase-c50BI" data-loading="false" data-size="medium" data-variant="invisible" aria-describedby=":Rld9lab:-loading-announcement"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-arrow-left" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"></path></svg></span><span data-component="text" class="prc-Button-Label-pTQ3x">Files</span></span></button><span role="tooltip" aria-label="Expand file tree" id="expand-button-file-tree-button" class="Tooltip__TooltipBase-sc-17tf59c-0 hWlpPn tooltipped-se"><button data-component="IconButton" type="button" data-testid="expand-file-tree-button" aria-controls="repos-file-tree" class="prc-Button-ButtonBase-c50BI position-relative ExpandFileTreeButton-module__expandButton--gL4is ExpandFileTreeButton-module__filesButtonBreakpoint--WfX9t fgColor-muted prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="invisible" aria-describedby=":R35d9lab:-loading-announcement" aria-labelledby="expand-button-file-tree-button"><svg aria-hidden="true" focusable="false" class="octicon octicon-sidebar-collapse" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M6.823 7.823a.25.25 0 0 1 0 .354l-2.396 2.396A.25.25 0 0 1 4 10.396V5.604a.25.25 0 0 1 .427-.177Z"></path><path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25H9.5v-13H1.75a.25.25 0 0 0-.25.25ZM11 14.5h3.25a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H11Z"></path></svg></button></span><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button></h2></div><div class="react-code-view-header-mb--narrow mr-2"><button type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-label="master branch" data-testid="anchor-button" class="Box-sc-g0xbh4-0 dmxRgG prc-Button-ButtonBase-c50BI ref-selector-class" data-loading="false" data-size="medium" data-variant="default" aria-describedby="branch-picker-repos-header-ref-selector-wide-loading-announcement" id="branch-picker-repos-header-ref-selector-wide"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="text" class="prc-Button-Label-pTQ3x"><div class="Box-sc-g0xbh4-0 bZBlpz"><div class="Box-sc-g0xbh4-0 lhTYNA"><svg aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></div><div class="Box-sc-g0xbh4-0 dbrgmi ref-selector-button-text-container"><span class="Text__StyledText-sc-17v1xeu-0 eMMFM"> <!-- -->master</span></div></div></span><span data-component="trailingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><button hidden="" data-hotkey-scope="read-only-cursor-text-area"></button></div><div class="Box-sc-g0xbh4-0 dHJiml react-code-view-header-mb--narrow"><div class="Box-sc-g0xbh4-0 cEytCf"><nav data-testid="breadcrumbs" aria-labelledby="repos-header-breadcrumb-heading" id="repos-header-breadcrumb" class="Box-sc-g0xbh4-0 fzFXnm"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading" id="repos-header-breadcrumb-heading">Breadcrumbs</h2><ol class="Box-sc-g0xbh4-0 iMnkmv"><li class="Box-sc-g0xbh4-0 ghzDag"><a class="Box-sc-g0xbh4-0 kHuKdh prc-Link-Link-85e08" sx="[object Object]" data-testid="breadcrumbs-repo-link" href="/huihut/interview/tree/master">interview</a></li></ol></nav><div data-testid="breadcrumbs-filename" class="Box-sc-g0xbh4-0 ghzDag"><span class="Text__StyledText-sc-17v1xeu-0 HlHVj" aria-hidden="true">/</span><h1 class="Box-sc-g0xbh4-0 jGhzSQ prc-Heading-Heading-6CmGO" tabindex="-1" id="file-name-id">README_en.md</h1></div><button data-component="IconButton" type="button" class="prc-Button-ButtonBase-c50BI ml-2 prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-describedby=":Rftd9lab:-loading-announcement" aria-labelledby=":R1td9lab:"><svg aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button><span class="Tooltip__StyledTooltip-sc-e45c7z-0 jOyaRH CopyToClipboardButton-module__tooltip--Dq1IB" data-direction="nw" aria-label="Copy path" aria-hidden="true" id=":R1td9lab:">Copy path</span></div></div></div><div class="react-code-view-header-element--wide"><div class="Box-sc-g0xbh4-0 faNtbn"><div class="d-flex gap-2"> <div><div class="Box-sc-g0xbh4-0 fmQaBv"><span class="TextInputWrapper__StyledTextInputBaseWrapper-sc-1mqhpbi-0 hLzFvi TextInputWrapper__StyledTextInputWrapper-sc-1mqhpbi-1 iHYdQq TextInput-wrapper" data-leading-visual="true" data-trailing-visual="true" aria-busy="false"><span class="TextInput-icon" id=":R5j6d9lab:" aria-hidden="true"><svg aria-hidden="true" focusable="false" class="octicon octicon-search" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg></span><input type="text" aria-label="Go to file" role="combobox" aria-controls="file-results-list" aria-expanded="false" aria-haspopup="dialog" autoCorrect="off" spellcheck="false" placeholder="Go to file" aria-describedby=":R5j6d9lab: :R5j6d9labH1:" data-component="input" class="UnstyledTextInput__ToggledUnstyledTextInput-sc-14ypya-0 jkNcAv" value=""/><span class="TextInput-icon" id=":R5j6d9labH1:" aria-hidden="true"></span></span></div><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden=""></button></div><button type="button" class="Box-sc-g0xbh4-0 dwNhzn prc-Button-ButtonBase-c50BI" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-describedby=":R2l6d9lab:-loading-announcement"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="text" class="prc-Button-Label-pTQ3x">Blame</span></span></button><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><button data-component="IconButton" type="button" aria-label="More file actions" title="More file actions" data-testid="more-file-actions-button-nav-menu-wide" aria-haspopup="true" aria-expanded="false" tabindex="0" class="Box-sc-g0xbh4-0 fGwBZA prc-Button-ButtonBase-c50BI js-blob-dropdown-click prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-describedby=":R156d9lab:-loading-announcement" id=":R156d9lab:"><svg aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button> </div></div></div><div class="react-code-view-header-element--narrow"><div class="Box-sc-g0xbh4-0 faNtbn"><div class="d-flex gap-2"> <button type="button" class="Box-sc-g0xbh4-0 dwNhzn prc-Button-ButtonBase-c50BI" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-describedby=":R2l7d9lab:-loading-announcement"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="text" class="prc-Button-Label-pTQ3x">Blame</span></span></button><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><button data-component="IconButton" type="button" aria-label="More file actions" title="More file actions" data-testid="more-file-actions-button-nav-menu-narrow" aria-haspopup="true" aria-expanded="false" tabindex="0" class="Box-sc-g0xbh4-0 fGwBZA prc-Button-ButtonBase-c50BI js-blob-dropdown-click prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="medium" data-variant="default" aria-describedby=":R157d9lab:-loading-announcement" id=":R157d9lab:"><svg aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button> </div></div></div></div></div></div></div></div><div class="Box-sc-g0xbh4-0 dJxjrT react-code-view-bottom-padding"> <div class="Box-sc-g0xbh4-0 eFxKDQ"></div> <!-- --> <!-- --> </div><div class="Box-sc-g0xbh4-0 dJxjrT"> <!-- --> <!-- --> <button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden=""></button><div class="d-flex flex-column border rounded-2 mb-3 pl-1"><div class="Box-sc-g0xbh4-0 dzCJzi"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading">Latest commit</h2><div style="width:120px" class="Skeleton Skeleton--text" data-testid="loading"> </div><div class="d-flex flex-shrink-0 gap-2"><div data-testid="latest-commit-details" class="d-none d-sm-flex flex-items-center"></div><div class="d-flex gap-2"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading">History</h2><a href="/huihut/interview/commits/master/README_en.md" class="prc-Button-ButtonBase-c50BI d-none d-lg-flex LinkButton-module__code-view-link-button--xvCGA flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible" aria-describedby=":R5dlal9lab:-loading-announcement"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span><span data-component="text" class="prc-Button-Label-pTQ3x"><span class="fgColor-default">History</span></span></span></a><div class="d-sm-none"></div><div class="d-flex d-lg-none"><span role="tooltip" aria-label="History" id="history-icon-button-tooltip" class="Tooltip__TooltipBase-sc-17tf59c-0 hWlpPn tooltipped-n"><a href="/huihut/interview/commits/master/README_en.md" class="prc-Button-ButtonBase-c50BI LinkButton-module__code-view-link-button--xvCGA flex-items-center fgColor-default" data-loading="false" data-size="small" data-variant="invisible" aria-describedby=":Rpdlal9lab:-loading-announcement history-icon-button-tooltip"><span data-component="buttonContent" data-align="center" class="prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-history" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg></span></span></a></span></div></div></div></div></div><div class="Box-sc-g0xbh4-0 ldRxiI"><div class="Box-sc-g0xbh4-0 fVkfyA container"><div class="Box-sc-g0xbh4-0 gNAmSV react-code-size-details-banner"><div class="Box-sc-g0xbh4-0 jNEwzY react-code-size-details-banner"><div class="Box-sc-g0xbh4-0 bsDwxw text-mono"><div title="163 KB" data-testid="blob-size" class="Truncate__StyledTruncate-sc-23o1d2-0 eAtkQz"><span>3443 lines (2430 loc) · 163 KB</span></div></div></div></div><div class="Box-sc-g0xbh4-0 jdLMhu react-blob-view-header-sticky" id="repos-sticky-header"><div class="Box-sc-g0xbh4-0 tOISc"><div class="react-blob-sticky-header"><div class="Box-sc-g0xbh4-0 hqwSEx"><div class="Box-sc-g0xbh4-0 bDVoEr"><div class="Box-sc-g0xbh4-0 kYLlPM"><div class="Box-sc-g0xbh4-0 gYjEmn"><button type="button" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-label="master branch" data-testid="anchor-button" class="Box-sc-g0xbh4-0 dmxRgG prc-Button-ButtonBase-c50BI ref-selector-class" data-loading="false" data-size="medium" data-variant="default" aria-describedby="branch-picker-repos-header-ref-selector-loading-announcement" id="branch-picker-repos-header-ref-selector"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="text" class="prc-Button-Label-pTQ3x"><div class="Box-sc-g0xbh4-0 bZBlpz"><div class="Box-sc-g0xbh4-0 lhTYNA"><svg aria-hidden="true" focusable="false" class="octicon octicon-git-branch" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg></div><div class="Box-sc-g0xbh4-0 dbrgmi ref-selector-button-text-container"><span class="Text__StyledText-sc-17v1xeu-0 eMMFM"> <!-- -->master</span></div></div></span><span data-component="trailingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-triangle-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></span></span></button><button hidden="" data-hotkey-scope="read-only-cursor-text-area"></button></div><div class="Box-sc-g0xbh4-0 kGqOLL"><div class="Box-sc-g0xbh4-0 fHind"><nav data-testid="breadcrumbs" aria-labelledby="sticky-breadcrumb-heading" id="sticky-breadcrumb" class="Box-sc-g0xbh4-0 fzFXnm"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading" id="sticky-breadcrumb-heading">Breadcrumbs</h2><ol class="Box-sc-g0xbh4-0 iMnkmv"><li class="Box-sc-g0xbh4-0 ghzDag"><a class="Box-sc-g0xbh4-0 kHuKdh prc-Link-Link-85e08" sx="[object Object]" data-testid="breadcrumbs-repo-link" href="/huihut/interview/tree/master">interview</a></li></ol></nav><div data-testid="breadcrumbs-filename" class="Box-sc-g0xbh4-0 ghzDag"><span class="Text__StyledText-sc-17v1xeu-0 lauzFl" aria-hidden="true">/</span><h1 class="Box-sc-g0xbh4-0 dnZoUW prc-Heading-Heading-6CmGO" tabindex="-1" id="sticky-file-name-id">README_en.md</h1></div></div></div></div><button style="--button-color:fg.default" type="button" class="Box-sc-g0xbh4-0 jRZWlf prc-Button-ButtonBase-c50BI" data-loading="false" data-size="small" data-variant="invisible" aria-describedby=":Riptal9lab:-loading-announcement"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="leadingVisual" class="prc-Button-Visual-2epfX prc-Button-VisualWrap-Db-eB"><svg aria-hidden="true" focusable="false" class="octicon octicon-arrow-up" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M3.47 7.78a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018L9 4.81v7.44a.75.75 0 0 1-1.5 0V4.81L4.53 7.78a.75.75 0 0 1-1.06 0Z"></path></svg></span><span data-component="text" class="prc-Button-Label-pTQ3x">Top</span></span></button></div></div></div><div class="Box-sc-g0xbh4-0 kTvpNk"><h2 class="sr-only ScreenReaderHeading-module__userSelectNone--vW4Cq prc-Heading-Heading-6CmGO" data-testid="screen-reader-heading">File metadata and controls</h2><div class="Box-sc-g0xbh4-0 iNMjfP"><ul aria-label="File view" class="SegmentedControl__SegmentedControlList-sc-1rzig82-0 lawgDG" data-size="small"><li class="Box-sc-g0xbh4-0 fefCSX" data-selected="true"><button aria-current="true" class="SegmentedControlButton__SegmentedControlButtonStyled-sc-8lkgxl-0 dwImxt" type="button"><span class="segmentedControl-content"><div class="Box-sc-g0xbh4-0 segmentedControl-text" data-text="Preview">Preview</div></span></button></li><li class="Box-sc-g0xbh4-0 idgUkN"><button aria-current="false" class="SegmentedControlButton__SegmentedControlButtonStyled-sc-8lkgxl-0 iFTkun" type="button"><span class="segmentedControl-content"><div class="Box-sc-g0xbh4-0 segmentedControl-text" data-text="Code">Code</div></span></button></li><li class="Box-sc-g0xbh4-0 idgUkN"><button aria-current="false" class="SegmentedControlButton__SegmentedControlButtonStyled-sc-8lkgxl-0 bHmvop" type="button"><span class="segmentedControl-content"><div class="Box-sc-g0xbh4-0 segmentedControl-text" data-text="Blame">Blame</div></span></button></li></ul><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><div class="Box-sc-g0xbh4-0 jNEwzY react-code-size-details-in-header"><div class="Box-sc-g0xbh4-0 bsDwxw text-mono"><div title="163 KB" data-testid="blob-size" class="Truncate__StyledTruncate-sc-23o1d2-0 eAtkQz"><span>3443 lines (2430 loc) · 163 KB</span></div></div></div></div><div class="Box-sc-g0xbh4-0 kcLCKF"><div class="Box-sc-g0xbh4-0 kVWtTz react-blob-header-edit-and-raw-actions"><div class="Box-sc-g0xbh4-0 prc-ButtonGroup-ButtonGroup-vcMeG"><div><a href="https://github.com/huihut/interview/raw/refs/heads/master/README_en.md" data-testid="raw-button" class="Box-sc-g0xbh4-0 gWqxTd prc-Button-ButtonBase-c50BI" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default" aria-describedby=":R5csptal9lab:-loading-announcement"><span data-component="buttonContent" class="Box-sc-g0xbh4-0 gUkoLg prc-Button-ButtonContent-HKbr-"><span data-component="text" class="prc-Button-Label-pTQ3x">Raw</span></span></a></div><div><button data-component="IconButton" type="button" aria-label="Copy raw content" data-testid="copy-raw-button" class="prc-Button-ButtonBase-c50BI prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default" aria-describedby=":Rpcsptal9lab:-loading-announcement"><svg aria-hidden="true" focusable="false" class="octicon octicon-copy" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button></div><div><span role="tooltip" aria-label="Download raw file" id=":Rdcsptal9lab:" class="Tooltip__TooltipBase-sc-17tf59c-0 hWlpPn tooltipped-n"><button data-component="IconButton" type="button" aria-label="Download raw content" data-testid="download-raw-button" class="Box-sc-g0xbh4-0 ivobqY prc-Button-ButtonBase-c50BI prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="small" data-variant="default" aria-describedby=":Rtcsptal9lab:-loading-announcement"><svg aria-hidden="true" focusable="false" class="octicon octicon-download" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"></path><path d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"></path></svg></button></span></div></div><button hidden="" data-testid="raw-button-shortcut" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden="" data-testid="copy-raw-button-shortcut" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden="" data-testid="download-raw-button-shortcut" data-hotkey-scope="read-only-cursor-text-area"></button></div><button data-component="IconButton" type="button" aria-label="Outline" aria-pressed="false" class="Box-sc-g0xbh4-0 iNRSob prc-Button-ButtonBase-c50BI prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-describedby=":R6sptal9lab:-loading-announcement"><svg aria-hidden="true" focusable="false" class="octicon octicon-list-unordered" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M5.75 2.5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5Zm0 5h8.5a.75.75 0 0 1 0 1.5h-8.5a.75.75 0 0 1 0-1.5ZM2 14a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm1-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM2 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></svg></button><div class="react-blob-header-edit-and-raw-actions-combined"><button data-component="IconButton" type="button" aria-label="Edit and raw actions" title="More file actions" data-testid="more-file-actions-button" aria-haspopup="true" aria-expanded="false" tabindex="0" class="Box-sc-g0xbh4-0 ffkqe prc-Button-ButtonBase-c50BI js-blob-dropdown-click prc-Button-IconButton-szpyj" data-loading="false" data-no-visuals="true" data-size="small" data-variant="invisible" aria-describedby=":Rnsptal9lab:-loading-announcement" id=":Rnsptal9lab:"><svg aria-hidden="true" focusable="false" class="octicon octicon-kebab-horizontal" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg></button></div></div></div></div><div></div></div><div class="Box-sc-g0xbh4-0 hGyMdv"><section aria-labelledby="file-name-id-wide file-name-id-mobile" class="Box-sc-g0xbh4-0 fGqKFv"><div class="Box-sc-g0xbh4-0 eoaCFS js-snippet-clipboard-copy-unpositioned undefined" data-hpc="true"><article class="markdown-body entry-content container-lg" itemprop="text"><div align="center" dir="auto"> 📖 Github | <a href="https://interview.huihut.com" rel="nofollow">📚 Docsify</a> </div> <br> <div align="center" dir="auto"> <a href="https://github.com/huihut/interview/">简体中文</a> | English </div> <br> <p dir="auto"><b></b></p><details><summary><b>💡 ON</b></summary><p dir="auto"></p> <p dir="auto">📚 This repository is a summary of the basic knowledge of recruiting job seekers and beginners in the direction of C / C ++ technology, including language, program library, data structure, algorithm, system, network, link loading library and other knowledge and interview experience, recruitment, internal push, etc. information.</p> <p dir="auto">💡 Side directory support methods:<a href="https://interview.huihut.com" rel="nofollow">📚 Docsify Doc</a>、<a href="https://github.com/jawil/GayHub">Github + TOC navigation</a>(<a href="https://raw.githubusercontent.com/huihut/interview/master/images/TOC%E9%A2%84%E8%A7%88.png" rel="nofollow">TOC preview.png</a>)</p> <p dir="auto">📄 Save as PDF: Use the Chrome browser to open the <a href="https://interview.huihut.com" rel="nofollow"> 📚 Docsify document </a> page, shrink the left directory-right click-print-select the target printer is Save as PDF-Save ( <a href="https://raw.githubusercontent.com/huihut/interview/master/images/PrintPreview.png" rel="nofollow">Print Preview.png</a> )</p> <p dir="auto">🙏 If there are any errors or improvements in the contents of the warehouse, issues or pr are welcome. Suggestions or discussions can be submitted at <a href="https://github.com/huihut/interview/issues/12" data-hovercard-type="issue" data-hovercard-url="/huihut/interview/issues/12/hovercard"># 12</a>. Due to my limited level, the knowledge points in the warehouse are from my original, reading notes, books, blog posts, etc. Non-original has been marked with the source, if there is any omission, please issue an issue. This warehouse follows the <a href="https://github.com/huihut/interview/blob/master/LICENSE">CC BY-NC-SA 4.0</a> agreement, please indicate the source for the reprint, and may not be used for commercial purposes.</p> </details> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">📑 Table of contents</h2><a id="user-content--table-of-contents" class="anchor" aria-label="Permalink: 📑 Table of contents" href="#-table-of-contents"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="#cc">➕ C/C++</a></li> <li><a href="#effective">⭐️ Effective</a></li> <li><a href="#stl">📦 STL</a></li> <li><a href="#data-structure">〽️ Data Structure</a></li> <li><a href="#algorithm">⚡️ Algorithm</a></li> <li><a href="#problems">❓ Problems</a></li> <li><a href="#os">💻 OS</a></li> <li><a href="#computer-network">☁️ Computer Network</a></li> <li><a href="#network-programming">🌩 Network Programming</a></li> <li><a href="#database">💾 Database</a></li> <li><a href="#design-pattern">📏 Design Pattern</a></li> <li><a href="#link-loading-library">⚙️ Link Loading Library</a></li> <li><a href="#books">📚 Books</a></li> <li><a href="#cc-development-direction">🔱 C/C++ development direction</a></li> <li><a href="#review-of-brush-questions-website">💯 Review of Brush Questions Website</a></li> <li><a href="#interview-questions-experience">📝 Interview Questions Experience</a></li> <li><a href="#recruitment-time-post">📆 Recruitment time post</a></li> <li><a href="#recommend">👍 Recommend</a></li> <li><a href="#contributor">👬 Contributor</a></li> <li><a href="#license">📜 License</a></li> </ul> <p dir="auto"><a id="user-content-cc"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">➕ C/C++</h2><a id="user-content--cc" class="anchor" aria-label="Permalink: ➕ C/C++" href="#-cc"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">const</h3><a id="user-content-const" class="anchor" aria-label="Permalink: const" href="#const"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Function</h4><a id="user-content-function" class="anchor" aria-label="Permalink: Function" href="#function"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Modify the variable, indicating that the variable cannot be changed;</li> <li>Modified pointers, divided into pointers to const (pointer to const) and pointers that are constants themselves (const pointer, const pointer);</li> <li>Modified references, references to constants (reference to const), are used for formal parameter types, which avoids copying and function modification of values;</li> <li>Decorate a member function, stating that member variables cannot be modified within the member function.</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">const Pointers and references</h4><a id="user-content-const-pointers-and-references" class="anchor" aria-label="Permalink: const Pointers and references" href="#const-pointers-and-references"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Pointer <ul dir="auto"> <li>Pointer to const</li> <li>A pointer to a constant itself (const pointer)</li> </ul> </li> <li>Reference <ul dir="auto"> <li>Reference to const</li> <li>There is no const reference because the reference is an alias of an object, the reference is not an object</li> </ul> </li> </ul> <blockquote> <p dir="auto">(Think of it for convenience) The value modified by const (after const) cannot be changed, such as <code>p2</code>, <code>p3</code> in the usage example below</p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">use</h4><a id="user-content-use" class="anchor" aria-label="Permalink: use" href="#use"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">const use</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// class class A { private: const int a; // constant object member, can use initialization list or in-class initializer public: // Constructor A() : a(0) { }; A(int x) : a(x) { }; // initialize list // const can be used to distinguish between overloaded functions int getValue(); // ordinary member function int getValue() const; // constant member function, must not modify the value of any data member in the class }; void function() { // object A b; // ordinary object, can call all member functions const A a; // constant object, can only call constant member functions const A *p = &a; // pointer variable, point to a constant object const A &q = a; // reference to constant object // pointer char greeting[] = "Hello"; char* p1 = greeting; // pointer variable, pointing to a character array variable const char* p2 = greeting; // pointer variable, pointing to a character array constant (char followed by const, indicating that the character pointed to (char) cannot be changed) char* const p3 = greeting; // itself is a constant pointer to a character array variable (const followed by p3, indicating that the p3 pointer itself cannot be changed) const char* const p4 = greeting; // a pointer to a constant itself, pointing to a character array constant } // function void function1(const int Var); // the passed parameters are immutable within the function void function2(const char* Var); // The content pointed to by the parameter pointer is constant void function3(char* const Var); // parameter pointer is constant void function4(const int& Var); // the reference parameter is constant inside the function // function return value const int function5(); // returns a constant const int* function6(); // returns a pointer variable to a constant, use: const int * p = function6 (); int* const function7(); // returns a constant pointer to a variable, use: int * const p = function7 ();"><pre><span class="pl-c"><span class="pl-c">//</span> class</span> <span class="pl-k">class</span> <span class="pl-en">A</span> { <span class="pl-k">private:</span> <span class="pl-k">const</span> <span class="pl-k">int</span> a; <span class="pl-c"><span class="pl-c">//</span> constant object member, can use initialization list or in-class initializer</span> <span class="pl-k">public:</span> <span class="pl-c"><span class="pl-c">//</span> Constructor</span> <span class="pl-en">A</span>() : a(<span class="pl-c1">0</span>) { }; <span class="pl-en">A</span>(<span class="pl-k">int</span> x) : a(x) { }; <span class="pl-c"><span class="pl-c">//</span> initialize list</span> <span class="pl-c"><span class="pl-c">//</span> const can be used to distinguish between overloaded functions</span> <span class="pl-k">int</span> <span class="pl-en">getValue</span>(); <span class="pl-c"><span class="pl-c">//</span> ordinary member function</span> <span class="pl-k">int</span> <span class="pl-en">getValue</span>() <span class="pl-k">const</span>; <span class="pl-c"><span class="pl-c">//</span> constant member function, must not modify the value of any data member in the class</span> }; <span class="pl-k">void</span> <span class="pl-en">function</span>() { <span class="pl-c"><span class="pl-c">//</span> object</span> A b; <span class="pl-c"><span class="pl-c">//</span> ordinary object, can call all member functions</span> <span class="pl-k">const</span> A a; <span class="pl-c"><span class="pl-c">//</span> constant object, can only call constant member functions</span> <span class="pl-k">const</span> A *p = &a; <span class="pl-c"><span class="pl-c">//</span> pointer variable, point to a constant object</span> <span class="pl-k">const</span> A &q = a; <span class="pl-c"><span class="pl-c">//</span> reference to constant object</span> <span class="pl-c"><span class="pl-c">//</span> pointer</span> <span class="pl-k">char</span> greeting[] = <span class="pl-s"><span class="pl-pds">"</span>Hello<span class="pl-pds">"</span></span>; <span class="pl-k">char</span>* p1 = greeting; <span class="pl-c"><span class="pl-c">//</span> pointer variable, pointing to a character array variable</span> <span class="pl-k">const</span> <span class="pl-k">char</span>* p2 = greeting; <span class="pl-c"><span class="pl-c">//</span> pointer variable, pointing to a character array constant (char followed by const, indicating that the character pointed to (char) cannot be changed)</span> <span class="pl-k">char</span>* <span class="pl-k">const</span> p3 = greeting; <span class="pl-c"><span class="pl-c">//</span> itself is a constant pointer to a character array variable (const followed by p3, indicating that the p3 pointer itself cannot be changed)</span> <span class="pl-k">const</span> <span class="pl-k">char</span>* <span class="pl-k">const</span> p4 = greeting; <span class="pl-c"><span class="pl-c">//</span> a pointer to a constant itself, pointing to a character array constant</span> } <span class="pl-c"><span class="pl-c">//</span> function</span> <span class="pl-k">void</span> <span class="pl-en">function1</span>(<span class="pl-k">const</span> <span class="pl-k">int</span> Var); <span class="pl-c"><span class="pl-c">//</span> the passed parameters are immutable within the function</span> <span class="pl-k">void</span> <span class="pl-en">function2</span>(<span class="pl-k">const</span> <span class="pl-k">char</span>* Var); <span class="pl-c"><span class="pl-c">//</span> The content pointed to by the parameter pointer is constant</span> <span class="pl-k">void</span> <span class="pl-en">function3</span>(<span class="pl-k">char</span>* <span class="pl-k">const</span> Var); <span class="pl-c"><span class="pl-c">//</span> parameter pointer is constant</span> <span class="pl-k">void</span> <span class="pl-en">function4</span>(<span class="pl-k">const</span> <span class="pl-k">int</span>& Var); <span class="pl-c"><span class="pl-c">//</span> the reference parameter is constant inside the function</span> <span class="pl-c"><span class="pl-c">//</span> function return value</span> <span class="pl-k">const</span> <span class="pl-k">int</span> <span class="pl-en">function5</span>(); <span class="pl-c"><span class="pl-c">//</span> returns a constant</span> <span class="pl-k">const</span> <span class="pl-k">int</span>* <span class="pl-en">function6</span>(); <span class="pl-c"><span class="pl-c">//</span> returns a pointer variable to a constant, use: const int * p = function6 ();</span> <span class="pl-k">int</span>* <span class="pl-k">const</span> <span class="pl-en">function7</span>(); <span class="pl-c"><span class="pl-c">//</span> returns a constant pointer to a variable, use: int * const p = function7 ();</span></pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">#define and const constants</h4><a id="user-content-define-and-const-constants" class="anchor" aria-label="Permalink: #define and const constants" href="#define-and-const-constants"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>#define</th> <th>const constants</th> </tr> </thead> <tbody> <tr> <td>Macro definitions, equivalent to character substitution</td> <td>constant declarations</td> </tr> <tr> <td>preprocessor processing</td> <td>compiler processing</td> </tr> <tr> <td>without type safety checking</td> <td>with type safety checking</td> </tr> <tr> <td>no memory allocation</td> <td>memory allocation required</td> </tr> <tr> <td>stored in code segment</td> <td>stored in data segment</td> </tr> <tr> <td>Can be canceled by <code>#undef</code></td> <td>Not cancelable</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">static</h3><a id="user-content-static" class="anchor" aria-label="Permalink: static" href="#static"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Function</h4><a id="user-content-function-1" class="anchor" aria-label="Permalink: Function" href="#function-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Modify ordinary variables, modify the storage area and life cycle of the variables, make the variables stored in the static area, allocate space before the <code>main</code> function runs, if there is an initial value, initialize it with the initial value, if there is no initial value, the system uses the default Value to initialize it.</li> <li>Modify ordinary functions to indicate the scope of the function, which can only be used in the file where the function is defined. When developing a project with multiple people, in order to prevent duplicate names from functions in other people's namespaces, you can position functions as static.</li> <li>Decorate member variables. Decorate member variables so that all objects hold only one of the variable, and you can access the member without generating an object.</li> <li>Decorate member functions. Decorate member functions so that they can be accessed without generating objects, but non-static members cannot be accessed within static functions.</li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">this pointer</h3><a id="user-content-this-pointer" class="anchor" aria-label="Permalink: this pointer" href="#this-pointer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li><code>this</code> pointer is a special pointer hidden in every non-static member function. It points to the object that called the member function.</li> <li>When calling a member function on an object, the compiler first assigns the address of the object to the <code>this</code> pointer, and then calls the member function. Each time the member function accesses a data member, the <code>this</code> pointer is implicitly used.</li> <li>When a member function is called, it is automatically passed an implicit parameter, which is a pointer to the object where the member function is located.</li> <li>The <code>this</code> pointer is implicitly declared as: <code>ClassName * const this</code>, which means that the <code>this</code> pointer cannot be assigned; in the <code>const</code> member function of the <code>ClassName</code> class, the type of the <code>this</code> pointer For: <code>const ClassName * const</code>, this means that the object pointed to by the <code>this</code> pointer cannot be modified (that is, the data members of such objects cannot be assigned);</li> <li><code>this</code> is not a regular variable, but an rvalue, so you cannot get the address of <code>this</code> (you can't <code>& this</code>).</li> <li>It is often necessary to explicitly reference the <code>this</code> pointer in the following scenarios: <ol dir="auto"> <li>To implement a chained reference to an object;</li> <li>To avoid performing assignments on the same object;</li> <li>When implementing some data structures, such as <code>list</code>.</li> </ol> </li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">inline function</h3><a id="user-content-inline-function" class="anchor" aria-label="Permalink: inline function" href="#inline-function"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Features</h4><a id="user-content-features" class="anchor" aria-label="Permalink: Features" href="#features"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Equivalent to writing the contents of the inline function at the call of the inline function;</li> <li>It is equivalent to directly execute the function body without executing the steps of entering the function;</li> <li>Equivalent to a macro, but with more type checking than a macro, it really has function characteristics;</li> <li>The compiler generally does not inline inline functions that include complex operations such as loops, recursion, and switch;</li> <li>Functions defined in class declarations, other than virtual functions, are automatically implicitly treated as inline functions.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">use</h4><a id="user-content-use-1" class="anchor" aria-label="Permalink: use" href="#use-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">inline use</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Statement 1 (plus inline, recommended) inline int functionName(int first, int second,...); // statement 2 (without inline) int functionName(int first, int second,...); // definition inline int functionName(int first, int second,...) {/****/}; // inside class definition, implicitly inline class A { int doA() { return 0; } // implicit inlining } // definition outside the class, need to be explicitly inlined class A { int doA(); } inline int A::doA() { return 0; } // requires explicit inlining"><pre><span class="pl-c"><span class="pl-c">//</span> Statement 1 (plus inline, recommended)</span> <span class="pl-k">inline</span> <span class="pl-k">int</span> <span class="pl-en">functionName</span>(<span class="pl-k">int</span> first, <span class="pl-k">int</span> second,...); <span class="pl-c"><span class="pl-c">//</span> statement 2 (without inline)</span> <span class="pl-k">int</span> <span class="pl-en">functionName</span>(<span class="pl-k">int</span> first, <span class="pl-k">int</span> second,...); <span class="pl-c"><span class="pl-c">//</span> definition</span> <span class="pl-k">inline</span> <span class="pl-k">int</span> <span class="pl-en">functionName</span>(<span class="pl-k">int</span> first, <span class="pl-k">int</span> second,...) {<span class="pl-c"><span class="pl-c">/*</span>**<span class="pl-c">*/</span></span>}; <span class="pl-c"><span class="pl-c">//</span> inside class definition, implicitly inline</span> <span class="pl-k">class</span> <span class="pl-en">A</span> { <span class="pl-k">int</span> <span class="pl-en">doA</span>() { <span class="pl-k">return</span> <span class="pl-c1">0</span>; } <span class="pl-c"><span class="pl-c">//</span> implicit inlining</span> }<span class="pl-ii"></span> <span class="pl-c"><span class="pl-c">//</span> definition outside the class, need to be explicitly inlined</span> <span class="pl-k">class</span> <span class="pl-en">A</span> { <span class="pl-k">int</span> <span class="pl-en">doA</span>(); }<span class="pl-ii"></span> <span class="pl-k">inline</span> <span class="pl-k">int</span> <span class="pl-en">A::doA</span>() { <span class="pl-k">return</span> <span class="pl-c1">0</span>; } <span class="pl-c"><span class="pl-c">//</span> requires explicit inlining</span></pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Compiler processing steps for inline functions</h4><a id="user-content-compiler-processing-steps-for-inline-functions" class="anchor" aria-label="Permalink: Compiler processing steps for inline functions" href="#compiler-processing-steps-for-inline-functions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Copy the inline function body to the <code>inline</code> function call point;</li> <li>Allocate memory space for local variables in the used <code>inline</code> function;</li> <li>Map the input parameters and return values of the <code>inline</code> function to the local variable space of the calling method;</li> <li>If the <code>inline</code> function has multiple return points, turn it into a branch at the end of the inline function code block (using <code>GOTO</code>).</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Advantages and disadvantages</h4><a id="user-content-advantages-and-disadvantages" class="anchor" aria-label="Permalink: Advantages and disadvantages" href="#advantages-and-disadvantages"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Advantages</p> <ol dir="auto"> <li>Inline functions, like macro functions, perform code expansion at the callee's place, eliminating the need to push parameters on the stack, open and recover stack frames, and return results, etc., thereby improving program execution speed.</li> <li>Compared to macro functions, inline functions do security checks or automatic type conversions (as with normal functions) when code is expanded, while macro definitions do not.</li> <li>Declaring a member function that is also defined in a class automatically converts it into an inline function, so inline functions can access class member variables, while macro definitions cannot.</li> <li>Inline functions are debuggable at runtime, while macro definitions are not.</li> </ol> <p dir="auto">Disadvantages</p> <ol dir="auto"> <li>Code bloat. Inlining is at the expense of code bloat (copy), eliminating the overhead of function calls. If the time to execute the code in the function body is greater than the cost of the function call, then the efficiency gain will be small. On the other hand, copying the code for each inline function call will increase the total code size of the program and consume more memory space.</li> <li>The inline function cannot be upgraded with the function library upgrade. Changes to the inline function require recompilation, unlike non-inline, which can be linked directly.</li> <li>Whether it is inline or not is beyond the programmer's control. Inline functions are just suggestions to the compiler. The decision whether to inline functions is up to the compiler.</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Can a virtual function be an inline function?</h4><a id="user-content-can-a-virtual-function-be-an-inline-function" class="anchor" aria-label="Permalink: Can a virtual function be an inline function?" href="#can-a-virtual-function-be-an-inline-function"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto"><a href="Http://www.cs.technion.ac.il/users/yechiel/c++-faq/inline-virtuals.html" rel="nofollow">Are "inline virtual" member functions ever actually "inlined"?</a></p> </blockquote> <ul dir="auto"> <li>A virtual function can be an inline function. Inline can modify a virtual function, but it cannot be inlined when the virtual function exhibits polymorphism.</li> <li>Inlining is recommended by the compiler, and the polymorphism of virtual functions is at runtime. The compiler cannot know which code is called at runtime, so virtual functions cannot be inlined at runtime (runtime). .</li> <li><code>inline virtual</code> The only time it can be inlined is: the compiler knows which class the object is called (such as <code>Base::who()</code> ), only if the compiler has an actual object instead of a pointer or reference to the object Will happen.</li> </ul> <p dir="auto">Virtual function inline use</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include <iostream> using namespace std; class Base { public: inline virtual void who() { cout << "I am Base\n"; } virtual ~Base() {} }; class Derived : public Base { public: inline void who() // Implicit inlining when not writing inline { cout << "I am Derived\n"; } }; int main() { // The virtual function who () here is called through the concrete object (b) of the class (Base), which can be determined during compilation, so it can be inlined, but whether it is inlined depends on the compilation Device. Base b; b.who(); // The virtual function here is called through a pointer, which is polymorphic and needs to be determined during runtime, so it cannot be inlined. Base *ptr = new Derived(); ptr->who(); // Because Base has a virtual destructor (virtual ~ Base () {}), when deleting, the Derived destructor is called first, and then the Base destructor is called to prevent memory leaks. delete ptr; ptr = nullptr; system("pause"); return 0; } "><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span> <span class="pl-k">using</span> <span class="pl-k">namespace</span> <span class="pl-en">std</span><span class="pl-k">;</span> <span class="pl-k">class</span> <span class="pl-en">Base</span> { <span class="pl-k">public:</span> <span class="pl-k">inline</span> <span class="pl-k">virtual</span> <span class="pl-k">void</span> <span class="pl-en">who</span>() { cout << <span class="pl-s"><span class="pl-pds">"</span>I am Base<span class="pl-cce">\n</span><span class="pl-pds">"</span></span>; } <span class="pl-k">virtual</span> <span class="pl-en">~Base</span>() {} }; <span class="pl-k">class</span> <span class="pl-en">Derived</span> : <span class="pl-k">public</span> <span class="pl-en">Base</span> { <span class="pl-k">public:</span> <span class="pl-k">inline</span> <span class="pl-k">void</span> <span class="pl-en">who</span>() <span class="pl-c"><span class="pl-c">//</span> Implicit inlining when not writing inline</span> { cout << <span class="pl-s"><span class="pl-pds">"</span>I am Derived<span class="pl-cce">\n</span><span class="pl-pds">"</span></span>; } }; <span class="pl-k">int</span> <span class="pl-en">main</span>() { <span class="pl-c"><span class="pl-c">//</span> The virtual function who () here is called through the concrete object (b) of the class (Base), which can be determined during compilation, so it can be inlined, but whether it is inlined depends on the compilation Device.</span> Base b; b.<span class="pl-c1">who</span>(); <span class="pl-c"><span class="pl-c">//</span> The virtual function here is called through a pointer, which is polymorphic and needs to be determined during runtime, so it cannot be inlined.</span> Base *ptr = <span class="pl-k">new</span> <span class="pl-c1">Derived</span>(); ptr-><span class="pl-c1">who</span>(); <span class="pl-c"><span class="pl-c">//</span> Because Base has a virtual destructor (virtual ~ Base () {}), when deleting, the Derived destructor is called first, and then the Base destructor is called to prevent memory leaks.</span> <span class="pl-k">delete</span> ptr; ptr = <span class="pl-c1">nullptr</span>; <span class="pl-c1">system</span>(<span class="pl-s"><span class="pl-pds">"</span>pause<span class="pl-pds">"</span></span>); <span class="pl-k">return</span> <span class="pl-c1">0</span>; } </pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">volatile</h3><a id="user-content-volatile" class="anchor" aria-label="Permalink: volatile" href="#volatile"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="volatile int i = 10; "><pre><span class="pl-k">volatile</span> <span class="pl-k">int</span> i = <span class="pl-c1">10</span>; </pre></div> <ul dir="auto"> <li>The volatile keyword is a type modifier, and the type variable declared with it indicates that it can be changed by some factors unknown to the compiler (operating system, hardware, other threads, etc.). So using volatile tells the compiler that such objects should not be optimized.</li> <li>Variables declared by the volatile keyword must be fetched from memory each time they are accessed (variables that are not modified by volatile may be fetched from CPU registers due to compiler optimizations)</li> <li>const can be volatile (such as a read-only status register)</li> <li>Pointer can be volatile</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">assert()</h3><a id="user-content-assert" class="anchor" aria-label="Permalink: assert()" href="#assert"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Assertions are macros, not functions. The prototype of the assert macro is defined in <code><assert.h></code> (C), <code><cassert></code> (C ++), and its role is to terminate program execution if its condition returns an error. You can turn off assert by defining <code>NDEBUG</code>, but it needs to be at the beginning of the source code, before <code>include <assert.h></code> .</p> <p dir="auto">assert () uses</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#define NDEBUG // Add this line, assert is not available #include <assert.h> assert( p != NULL ); // assert is not available"><pre>#<span class="pl-k">define</span> <span class="pl-en">NDEBUG</span> <span class="pl-c"><span class="pl-c">//</span> Add this line, assert is not available</span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>assert.h<span class="pl-pds">></span></span> <span class="pl-en">assert</span>( p != <span class="pl-c1">NULL</span> ); <span class="pl-c"><span class="pl-c">//</span> assert is not available</span></pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">sizeof()</h3><a id="user-content-sizeof" class="anchor" aria-label="Permalink: sizeof()" href="#sizeof"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>sizeof For arrays - get the size of the entire array.</li> <li>sizeof For pointers - get the size of the space occupied by the pointer itself.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">#pragma pack(n)</h3><a id="user-content-pragma-packn" class="anchor" aria-label="Permalink: #pragma pack(n)" href="#pragma-packn"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Set structure, union, and class member variables to be n-byte aligned</p> <p dir="auto">#pragma pack (n) use</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#pragma pack(push) // save alignment state #pragma pack(4) // Set to 4 byte alignment struct test { char m1; double m4; int m3; }; #pragma pack(pop) // Restore alignment"><pre>#<span class="pl-k">pragma</span> pack(push) <span class="pl-c"><span class="pl-c">//</span> save alignment state</span> #<span class="pl-k">pragma</span> pack(4) <span class="pl-c"><span class="pl-c">//</span> Set to 4 byte alignment</span> <span class="pl-k">struct</span> <span class="pl-en">test</span> { <span class="pl-k">char</span> m1; <span class="pl-k">double</span> m4; <span class="pl-k">int</span> m3; }; #<span class="pl-k">pragma</span> pack(pop) <span class="pl-c"><span class="pl-c">//</span> Restore alignment</span></pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Bit field</h3><a id="user-content-bit-field" class="anchor" aria-label="Permalink: Bit field" href="#bit-field"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Bit mode: 2; // mode is 2 digits"><pre>Bit mode: <span class="pl-c1">2</span>; <span class="pl-c"><span class="pl-c">//</span> mode is 2 digits</span></pre></div> <p dir="auto">A class can define its (non-static) data members as bit-fields, which contain a certain number of binary bits in a bit-field. When a program needs to transfer binary data to other programs or hardware devices, the bit field is usually used.</p> <ul dir="auto"> <li>The layout of the bit field in memory is machine-dependent</li> <li>The type of the bit field must be an integer or enumerated type. The behavior of the bit field in a signed type will depend on the implementation.</li> <li>The fetch operator (&) cannot be applied to the bit field, and no pointer can point to the bit field of the class</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">extern "C"</h3><a id="user-content-extern-c" class="anchor" aria-label="Permalink: extern "C"" href="#extern-c"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Extern-qualified functions or variables are of type extern</li> <li>Variables and functions decorated with <code>extern" C "</code> are compiled and linked in C</li> </ul> <p dir="auto">The function of <code>extern" C "</code> is to let the C ++ compiler treat the code declared by <code>extern" C "</code> as C language code, which can avoid the problem that the code cannot be linked with the symbols in the C language library due to symbol modification. .</p> <p dir="auto">extern "C" demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#ifdef __cplusplus extern "C" { #endif void *memset(void *, int, size_t); #ifdef __cplusplus } #endif"><pre>#<span class="pl-k">ifdef</span> __cplusplus <span class="pl-k">extern</span> <span class="pl-s"><span class="pl-pds">"</span>C<span class="pl-pds">"</span></span> { #endif <span class="pl-k">void</span> *<span class="pl-en">memset</span>(<span class="pl-k">void</span> *, <span class="pl-k">int</span>, <span class="pl-c1">size_t</span>); #<span class="pl-k">ifdef</span> __cplusplus } #<span class="pl-k">endif</span></pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">struct with typedef struct</h3><a id="user-content-struct-with-typedef-struct" class="anchor" aria-label="Permalink: struct with typedef struct" href="#struct-with-typedef-struct"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">In C</h4><a id="user-content-in-c" class="anchor" aria-label="Permalink: In C" href="#in-c"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="highlight highlight-source-c notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// c typedef struct Student { int age; } S;"><pre><span class="pl-c">// c</span> <span class="pl-k">typedef</span> <span class="pl-k">struct</span> <span class="pl-smi">Student</span> { <span class="pl-smi">int</span> <span class="pl-c1">age</span>; } <span class="pl-smi">S</span>;</pre></div> <p dir="auto">Equivalent to</p> <div class="highlight highlight-source-c notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// c struct Student { int age; }; typedef struct Student S;"><pre><span class="pl-c">// c</span> <span class="pl-k">struct</span> <span class="pl-smi">Student</span> { <span class="pl-smi">int</span> <span class="pl-c1">age</span>; }; <span class="pl-k">typedef</span> <span class="pl-k">struct</span> <span class="pl-smi">Student</span> <span class="pl-smi">S</span>;</pre></div> <p dir="auto">At this time <code>S</code> is equivalent to<code> struct Student</code>, but the two identifier namespaces are different.</p> <p dir="auto">You can also define <code>void Student(){}</code> that does not conflict with <code>struct Student</code> .</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">In C++</h4><a id="user-content-in-c-1" class="anchor" aria-label="Permalink: In C++" href="#in-c-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Because the compiler's rules for positioning symbols (search rules) have changed, it is different from the C language.</p> <p dir="auto">First, if <code>struct Student {...};</code> is defined in the class identifier space, when <code>Student me;</code> is used, the compiler will search the global identifier table. If <code>Student</code> is not found, it will be in the class identifier. search for.</p> <p dir="auto">That means it can use <code>Student</code> or <code>struct Student</code>, as follows:</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// cpp struct Student { int age; }; void f( Student me ); // correct, the "struct" keyword can be omitted"><pre><span class="pl-c"><span class="pl-c">//</span> cpp</span> <span class="pl-k">struct</span> <span class="pl-en">Student</span> { <span class="pl-k">int</span> age; }; <span class="pl-k">void</span> <span class="pl-en">f</span>( Student me ); <span class="pl-c"><span class="pl-c">//</span> correct, the "struct" keyword can be omitted</span></pre></div> <p dir="auto">If a function with the same name as <code>Student</code> is defined, <code>Student</code> only represents the function, not the structure, as follows:</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="typedef struct Student { int age; } S; void Student() {} //Correct, "Student" only represents this function after definition //void S() {} // Error, symbol "S" has been defined as an alias for "struct Student" int main() { Student(); struct Student me; // Or "S me"; return 0; }"><pre><span class="pl-k">typedef</span> <span class="pl-k">struct</span> <span class="pl-en">Student</span> { <span class="pl-k">int</span> age; } S; <span class="pl-k">void</span> <span class="pl-en">Student</span>() {} <span class="pl-c"><span class="pl-c">//</span>Correct, "Student" only represents this function after definition</span> <span class="pl-c"><span class="pl-c">//</span>void S() {} // Error, symbol "S" has been defined as an alias for "struct Student"</span> <span class="pl-k">int</span> <span class="pl-en">main</span>() { <span class="pl-c1">Student</span>(); <span class="pl-k">struct</span> <span class="pl-en">Student</span> me; <span class="pl-c"><span class="pl-c">//</span> Or "S me";</span> <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">struct and class in C ++</h3><a id="user-content-struct-and-class-in-c-" class="anchor" aria-label="Permalink: struct and class in C ++" href="#struct-and-class-in-c-"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">In general, struct is more suitable as an implementation of a data structure, and class is more suitable as an implementation of an object.</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">The difference</h4><a id="user-content-the-difference" class="anchor" aria-label="Permalink: The difference" href="#the-difference"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>The most essential difference is the default access control <ol dir="auto"> <li>Default inherited access rights. struct is public and class is private.</li> <li>struct as the data structure implementation body, its default data access control is public, and class as the object implementation body, its default member variable access control is private.</li> </ol> </li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">union union</h3><a id="user-content-union-union" class="anchor" aria-label="Permalink: union union" href="#union-union"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Union is a special class that saves space. A union can have multiple data members, but only one data member can have a value at any time. When a member is assigned, other members become undefined. Union has the following characteristics:</p> <ul dir="auto"> <li>The default access control character is public</li> <li>May contain constructors and destructors</li> <li>Cannot contain members of reference type</li> <li>Cannot inherit from other classes and cannot be used as a base class</li> <li>Cannot contain virtual functions</li> <li>Anonymous union can directly access union members in the scope where it is defined</li> <li>Anonymous union cannot contain protected members or private members</li> <li>Global anonymous union must be static</li> </ul> <p dir="auto">union demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include<iostream> union UnionTest { UnionTest() : i(10) {}; int i; double d; }; static union { int i; double d; }; int main() { UnionTest u; union { int i; double d; }; std::cout << u.i << std::endl; // Output UnionTest union 10 ::i = 20; std::cout << ::i << std::endl; // Output global static anonymous union 20 i = 30; std::cout << i << std::endl; // Output of locally anonymous union of 30 return 0; }"><pre>#<span class="pl-k">include</span><span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span> <span class="pl-k">union</span> UnionTest { <span class="pl-c1">UnionTest</span>() : <span class="pl-c1">i</span>(<span class="pl-c1">10</span>) {}; <span class="pl-k">int</span> i; <span class="pl-k">double</span> d; }; <span class="pl-k">static</span> <span class="pl-k">union</span> { <span class="pl-k">int</span> i; <span class="pl-k">double</span> d; }; <span class="pl-k">int</span> <span class="pl-en">main</span>() { UnionTest u; <span class="pl-k">union</span> { <span class="pl-k">int</span> i; <span class="pl-k">double</span> d; }; std::cout << u.<span class="pl-smi">i</span> << std::endl; <span class="pl-c"><span class="pl-c">//</span> Output UnionTest union 10</span> ::i = <span class="pl-c1">20</span>; std::cout << ::i << std::endl; <span class="pl-c"><span class="pl-c">//</span> Output global static anonymous union 20</span> i = <span class="pl-c1">30</span>; std::cout << i << std::endl; <span class="pl-c"><span class="pl-c">//</span> Output of locally anonymous union of 30</span> <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">C implements C ++ classes</h3><a id="user-content-c-implements-c--classes" class="anchor" aria-label="Permalink: C implements C ++ classes" href="#c-implements-c--classes"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">C implements object-oriented features of C ++ (encapsulation, inheritance, polymorphism)</p> <ul dir="auto"> <li>Encapsulation: Use function pointers to encapsulate properties and methods into structures</li> <li>Inheritance: structure nesting</li> <li>Polymorphism: function pointers of parent and child methods are different</li> </ul> <blockquote> <p dir="auto"><a href="https://stackoverflow.com/a/351745" rel="nofollow">Can you write object-oriented code in C? [closed]</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">explicit (keyword)</h3><a id="user-content-explicit-keyword" class="anchor" aria-label="Permalink: explicit (keyword)" href="#explicit-keyword"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>explicit constructor modification prevents implicit conversion and copy initialization</li> <li>explicit conversions can prevent implicit conversions, except <a href="https://en.cppreference.com/w/cpp/language/implicit_conversion" rel="nofollow">conversion by context</a></li> </ul> <p dir="auto">explicit demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct A { A(int) { } operator bool() const { return true; } }; struct B { explicit B(int) {} explicit operator bool() const { return true; } }; void doA(A a) {} void doB(B b) {} int main() { A a1(1); // OK:direct initialization A a2 = 1; // OK:copy initialization A a3{ 1 }; // OK:direct list initialization A a4 = { 1 }; // OK:copy list initialization A a5 = (A)1; // OK:Allow explicit conversion of static_cast doA(1); // OK:Allow implicit conversion from int to A if (a1); // OK: implicit conversion from A to bool using conversion function A ::operator bool() bool a6(a1); // OK: implicit conversion from A to bool using conversion function A::operator bool() bool a7 = a1; // OK: implicit conversion from A to bool using conversion function A::operator bool() bool a8 = static_cast<bool>(a1); // OK: static_cast for direct initialization B b1(1); // OK:direct initialization B b2 = 1; // Error: Object modified by explicit constructor cannot be initialized by copying B b3{ 1 }; // OK:direct list initialization B b4 = { 1 }; // Error: Object modified by explicit constructor cannot copy list initialization B b5 = (B)1; // OK: Allow explicit conversion of static_cast doB(1); // Error: Objects whose constructor is explicitly modified cannot be implicitly converted from int to B if (b1); // OK: objects modified by explicit conversion function B::operator bool() can be converted from B to bool by context bool b6(b1); // OK: Explicitly modified conversion function B::operator The object of bool() can be converted from B to bool by context bool b7 = b1; // Error: Objects modified by explicit conversion function B :: operator bool () cannot be implicitly converted bool b8 = static_cast<bool>(b1); // OK: static_cast performs direct initialization return 0; }"><pre><span class="pl-k">struct</span> <span class="pl-en">A</span> { <span class="pl-en">A</span>(<span class="pl-k">int</span>) { } <span class="pl-k">operator</span> <span class="pl-en">bool</span>() <span class="pl-k">const</span> { <span class="pl-k">return</span> <span class="pl-c1">true</span>; } }; <span class="pl-k">struct</span> <span class="pl-en">B</span> { <span class="pl-k">explicit</span> <span class="pl-en">B</span>(<span class="pl-k">int</span>) {} <span class="pl-k">explicit</span> <span class="pl-k">operator</span> <span class="pl-en">bool</span>() <span class="pl-k">const</span> { <span class="pl-k">return</span> <span class="pl-c1">true</span>; } }; <span class="pl-k">void</span> <span class="pl-en">doA</span>(A a) {} <span class="pl-k">void</span> <span class="pl-en">doB</span>(B b) {} <span class="pl-k">int</span> <span class="pl-en">main</span>() { A <span class="pl-smi">a1</span>(<span class="pl-c1">1</span>); <span class="pl-c"><span class="pl-c">//</span> OK:direct initialization</span> A a2 = <span class="pl-c1">1</span>; <span class="pl-c"><span class="pl-c">//</span> OK:copy initialization</span> A a3{ <span class="pl-c1">1</span> }; <span class="pl-c"><span class="pl-c">//</span> OK:direct list initialization</span> A a4 = { <span class="pl-c1">1</span> }; <span class="pl-c"><span class="pl-c">//</span> OK:copy list initialization</span> A a5 = (A)<span class="pl-c1">1</span>; <span class="pl-c"><span class="pl-c">//</span> OK:Allow explicit conversion of static_cast</span> <span class="pl-c1">doA</span>(<span class="pl-c1">1</span>); <span class="pl-c"><span class="pl-c">//</span> OK:Allow implicit conversion from int to A</span> <span class="pl-k">if</span> (a1); <span class="pl-c"><span class="pl-c">//</span> OK: implicit conversion from A to bool using conversion function A ::operator bool()</span> <span class="pl-k">bool</span> <span class="pl-smi">a6</span>(a1); <span class="pl-c"><span class="pl-c">//</span> OK: implicit conversion from A to bool using conversion function A::operator bool()</span> <span class="pl-k">bool</span> a7 = a1; <span class="pl-c"><span class="pl-c">//</span> OK: implicit conversion from A to bool using conversion function A::operator bool()</span> <span class="pl-k">bool</span> a8 = <span class="pl-k">static_cast</span><<span class="pl-k">bool</span>>(a1); <span class="pl-c"><span class="pl-c">//</span> OK: static_cast for direct initialization</span> B <span class="pl-smi">b1</span>(<span class="pl-c1">1</span>); <span class="pl-c"><span class="pl-c">//</span> OK:direct initialization</span> B b2 = <span class="pl-c1">1</span>; <span class="pl-c"><span class="pl-c">//</span> Error: Object modified by explicit constructor cannot be initialized by copying</span> B b3{ <span class="pl-c1">1</span> }; <span class="pl-c"><span class="pl-c">//</span> OK:direct list initialization</span> B b4 = { <span class="pl-c1">1</span> }; <span class="pl-c"><span class="pl-c">//</span> Error: Object modified by explicit constructor cannot copy list initialization</span> B b5 = (B)<span class="pl-c1">1</span>; <span class="pl-c"><span class="pl-c">//</span> OK: Allow explicit conversion of static_cast</span> <span class="pl-c1">doB</span>(<span class="pl-c1">1</span>); <span class="pl-c"><span class="pl-c">//</span> Error: Objects whose constructor is explicitly modified cannot be implicitly converted from int to B</span> <span class="pl-k">if</span> (b1); <span class="pl-c"><span class="pl-c">//</span> OK: objects modified by explicit conversion function B::operator bool() can be converted from B to bool by context</span> <span class="pl-k">bool</span> <span class="pl-smi">b6</span>(b1); <span class="pl-c"><span class="pl-c">//</span> OK: Explicitly modified conversion function B::operator The object of bool() can be converted from B to bool by context</span> <span class="pl-k">bool</span> b7 = b1; <span class="pl-c"><span class="pl-c">//</span> Error: Objects modified by explicit conversion function B :: operator bool () cannot be implicitly converted</span> <span class="pl-k">bool</span> b8 = <span class="pl-k">static_cast</span><<span class="pl-k">bool</span>>(b1); <span class="pl-c"><span class="pl-c">//</span> OK: static_cast performs direct initialization</span> <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">friend - friend class and friend function</h3><a id="user-content-friend---friend-class-and-friend-function" class="anchor" aria-label="Permalink: friend - friend class and friend function" href="#friend---friend-class-and-friend-function"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Access to private members</li> <li>Destruction of encapsulation</li> <li>Friendship is not transitive</li> <li>One-way friendship</li> <li>There are no restrictions on the form and number of friend declarations</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">using</h3><a id="user-content-using" class="anchor" aria-label="Permalink: using" href="#using"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">using statement</h4><a id="user-content-using-statement" class="anchor" aria-label="Permalink: using statement" href="#using-statement"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">A <code>using declaration</code> introduces only one member of a namespace at a time. It allows us to know exactly which name is referenced in the program. Such as:</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="using namespace_name :: name;"><pre><span class="pl-k">using</span> namespace_name :: name;</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Using declaration of constructor</h4><a id="user-content-using-declaration-of-constructor" class="anchor" aria-label="Permalink: Using declaration of constructor" href="#using-declaration-of-constructor"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">In C ++ 11, a derived class can reuse the constructor defined by its direct base class.</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Derived : Base { public: using Base::Base; /* ... */ };"><pre><span class="pl-k">class</span> <span class="pl-en">Derived</span> : Base { <span class="pl-k">public:</span> <span class="pl-k">using</span> Base::Base; <span class="pl-c"><span class="pl-c">/*</span> ... <span class="pl-c">*/</span></span> };</pre></div> <p dir="auto">As above using statement, for each constructor of the base class, the compiler generates a derived class constructor corresponding to it (the parameter list is exactly the same). Generates the following type constructor:</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Derived (parms): Base (args) {}"><pre><span class="pl-en">Derived</span> (parms): Base (args) {}</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">using instructions</h4><a id="user-content-using-instructions" class="anchor" aria-label="Permalink: using instructions" href="#using-instructions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The <code>using directive</code> makes all names in a particular namespace visible, so we don't need to add any prefix qualifiers to them. Such as:</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="using namespace_name name;"><pre><span class="pl-k">using</span> namespace_name name;</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Minimize <code>using directives</code> to pollute namespaces</h4><a id="user-content-minimize-using-directives-to-pollute-namespaces" class="anchor" aria-label="Permalink: Minimize using directives to pollute namespaces" href="#minimize-using-directives-to-pollute-namespaces"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">Generally speaking, it is safer to use the using command than the using compile command, because it** imports only the specified name**. If the name conflicts with a local name, the compiler will** issue instructions**. The using compile command imports all names, including names that may not be needed. If there is a conflict with a local name, the local name will override the namespace version, and the compiler will not issue a warning. In addition, the openness of the namespace means that the names of the namespace may be scattered in multiple places, which makes it difficult to know exactly which names have been added.</p> </blockquote> <p dir="auto">using demo</p> <p dir="auto">Minimize <code>using directives</code></p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="using namespace std;"><pre><span class="pl-k">using</span> <span class="pl-k">namespace</span> <span class="pl-en">std</span><span class="pl-k">;</span></pre></div> <p dir="auto">You should use <code>using declarations</code> more often</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="int x; std::cin >> x ; std::cout << x << std::endl;"><pre><span class="pl-k">int</span> x; std::cin >> x ; std::cout << x << std::endl;</pre></div> <p dir="auto">or</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="using std::cin; using std::cout; using std::endl; int x; cin >> x; cout << x << endl;"><pre><span class="pl-k">using</span> std::cin; <span class="pl-k">using</span> std::cout; <span class="pl-k">using</span> std::endl; <span class="pl-k">int</span> x; cin >> x; cout << x << endl;</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">:: scope resolution operator</h3><a id="user-content--scope-resolution-operator" class="anchor" aria-label="Permalink: :: scope resolution operator" href="#-scope-resolution-operator"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">classification</h4><a id="user-content-classification" class="anchor" aria-label="Permalink: classification" href="#classification"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Global scope (<code>:: name</code>): used before type names (classes, class members, member functions, variables, etc.) to indicate that the scope is a global namespace</li> <li>Class scope character (<code>class :: name</code>): used to indicate that the scope of the specified type is specific to a class</li> <li>Namespace scope (<code>namespace :: name</code>): used to indicate that the scope of the specified type is specific to a namespace</li> </ol> <p dir="auto">:: demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="int count = 11; // Global (: :) count class A { public: static int count; // Count (A::count) of class A }; int A::count = 21; void fun() { int count = 31; // Initialize the local count to 31 count = 32; // Set the local count to 32 } int main() { ::count = 12; // Test 1: Set the global count to 12 A::count = 22; // Test 2: Set the count of class A to 22 fun(); // Test 3 return 0; }"><pre><span class="pl-k">int</span> count = <span class="pl-c1">11</span>; <span class="pl-c"><span class="pl-c">//</span> Global (: :) count</span> <span class="pl-k">class</span> <span class="pl-en">A</span> { <span class="pl-k">public:</span> <span class="pl-k">static</span> <span class="pl-k">int</span> count; <span class="pl-c"><span class="pl-c">//</span> Count (A::count) of class A</span> }; <span class="pl-k">int</span> A::count = <span class="pl-c1">21</span>; <span class="pl-k">void</span> <span class="pl-en">fun</span>() { <span class="pl-k">int</span> count = <span class="pl-c1">31</span>; <span class="pl-c"><span class="pl-c">//</span> Initialize the local count to 31</span> count = <span class="pl-c1">32</span>; <span class="pl-c"><span class="pl-c">//</span> Set the local count to 32</span> } <span class="pl-k">int</span> <span class="pl-en">main</span>() { ::count = <span class="pl-c1">12</span>; <span class="pl-c"><span class="pl-c">//</span> Test 1: Set the global count to 12</span> A::count = <span class="pl-c1">22</span>; <span class="pl-c"><span class="pl-c">//</span> Test 2: Set the count of class A to 22</span> <span class="pl-c1">fun</span>(); <span class="pl-c"><span class="pl-c">//</span> Test 3</span> <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">enum - enum type</h3><a id="user-content-enum---enum-type" class="anchor" aria-label="Permalink: enum - enum type" href="#enum---enum-type"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Scoped Enumeration Type</h4><a id="user-content-scoped-enumeration-type" class="anchor" aria-label="Permalink: Scoped Enumeration Type" href="#scoped-enumeration-type"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum class open_modes { input, output, append };"><pre><span class="pl-k">enum</span> <span class="pl-k">class</span> <span class="pl-en">open_modes</span> { input, output, append };</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Unscoped enumeration type</h4><a id="user-content-unscoped-enumeration-type" class="anchor" aria-label="Permalink: Unscoped enumeration type" href="#unscoped-enumeration-type"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum color { red, yellow, green }; enum { floatPrec = 6, doublePrec = 10 };"><pre><span class="pl-k">enum</span> color { red, yellow, green }; <span class="pl-k">enum</span> { floatPrec = <span class="pl-c1">6</span>, doublePrec = <span class="pl-c1">10</span> };</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">decltype</h3><a id="user-content-decltype" class="anchor" aria-label="Permalink: decltype" href="#decltype"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">decltype keyword is used to check the declared type or expression type and value classification of an entity. grammar:</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="decltype ( expression )"><pre><span class="pl-en">decltype</span> ( expression )</pre></div> <p dir="auto">decltype demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Tail return allows us to declare the return type after the parameter list template <typename It> auto fcn(It beg, It end) -> decltype(*beg) { / process the sequence return *beg; // return a reference to an element in the sequence } // In order to use template parameter members, you must use typename template <typename It> auto fcn2(It beg, It end) -> typename remove_reference<decltype(*beg)>::type { // process the sequence return * beg; // return a copy of an element in the sequence }"><pre><span class="pl-c"><span class="pl-c">//</span> Tail return allows us to declare the return type after the parameter list</span> <span class="pl-k">template </span><<span class="pl-k">typename</span> It> <span class="pl-k">auto</span> <span class="pl-en">fcn</span>(It beg, It end) -> decltype(*beg) { / process the sequence <span class="pl-k">return</span> *beg; <span class="pl-c"><span class="pl-c">//</span> return a reference to an element in the sequence</span> } <span class="pl-c"><span class="pl-c">//</span> In order to use template parameter members, you must use typename</span> <span class="pl-k">template </span><<span class="pl-k">typename</span> It> <span class="pl-k">auto</span> <span class="pl-en">fcn2</span>(It beg, It end) -> typename remove_reference<decltype(*beg)>::type { <span class="pl-c"><span class="pl-c">//</span> process the sequence</span> <span class="pl-k">return</span> * beg; <span class="pl-c"><span class="pl-c">//</span> return a copy of an element in the sequence</span> }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">reference</h3><a id="user-content-reference" class="anchor" aria-label="Permalink: reference" href="#reference"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">lvalue reference</h4><a id="user-content-lvalue-reference" class="anchor" aria-label="Permalink: lvalue reference" href="#lvalue-reference"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Regular reference, which generally represents the identity of the object.</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">rvalue reference</h4><a id="user-content-rvalue-reference" class="anchor" aria-label="Permalink: rvalue reference" href="#rvalue-reference"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">An rvalue reference is a reference that must be bound to an rvalue (a temporary object, an object to be destroyed) and generally represents the value of the object.</p> <p dir="auto">An rvalue reference implements Move Sementics and Perfect Forwarding. Its main purpose is twofold:</p> <ul dir="auto"> <li>Eliminate unnecessary copying of objects when two objects interact, saving computing storage resources and improving efficiency.</li> <li>Ability to define generic functions more concisely.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Reference Collapse</h4><a id="user-content-reference-collapse" class="anchor" aria-label="Permalink: Reference Collapse" href="#reference-collapse"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><code>X & &</code>, <code>X & &&</code>, <code>X && &</code> can be folded into <code>X &</code></li> <li><code>X && &&</code> can be folded into <code>X &&</code></li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Macro</h3><a id="user-content-macro" class="anchor" aria-label="Permalink: Macro" href="#macro"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>A macro definition can implement a function similar to a function, but it is not a function after all, and the "parameters" in the brackets in the macro definition are not real parameters. The "parameters" are replaced one-to-one when the macro is expanded .</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Member initialization list</h3><a id="user-content-member-initialization-list" class="anchor" aria-label="Permalink: Member initialization list" href="#member-initialization-list"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">benefit</p> <ul dir="auto"> <li>More efficient: There is no need to call the default constructor once.</li> <li>In some cases it is necessary to use the initialization list: <ol dir="auto"> <li>Constant members, because constants can only be initialized and cannot be assigned, so they must be placed in the initialization list</li> <li>Reference types. References must be initialized at the time of definition and cannot be reassigned, so they must also be written in the initialization list.</li> <li>There is no class type for the default constructor, because the initialization list can be used to initialize without having to call the default constructor.</li> </ol> </li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">initializer_list list initialization</h3><a id="user-content-initializer_list-list-initialization" class="anchor" aria-label="Permalink: initializer_list list initialization" href="#initializer_list-list-initialization"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Initialize an object with a curly brace initializer list, where the corresponding constructor accepts a <code>std :: initializer_list</code> parameter.</p> <p dir="auto">initializer_list uses</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include <iostream> #include <vector> #include <initializer_list> template <class T> struct S { std::vector<T> v; S(std::initializer_list<T> l) : v(l) { std::cout << "constructed with a " << l.size() << "-element list\n"; } void append(std::initializer_list<T> l) { v.insert(v.end(), l.begin(), l.end()); } std::pair<const T*, std::size_t> c_arr() const { return {&v[0], v.size()}; // Copy the list initialization in the return statement // this does not use std :: initializer_list } }; template <typename T> void templated_fn(T) {} int main() { S<int> s = {1, 2, 3, 4, 5}; // copy initialization s.append({6, 7, 8}); // list initialization in function call std::cout << "The vector size is now " << s.c_arr().second << " ints:\n"; for (auto n : s.v) std::cout << n << ' '; std::cout << '\n'; std::cout << "Range-for over brace-init-list: \n"; for (int x : {-1, -2, -3}) // auto rules make this band for work std::cout << x << ' '; std::cout << '\n'; auto al = {10, 11, 12}; // special rules for auto std::cout << "The list bound to auto has size() = " << al.size() << '\n'; // templated_fn({1, 2, 3}); // Compile error! "{1, 2, 3}" is not an expression, // it has no type, so T cannot infer templated_fn<std::initializer_list<int>>({1, 2, 3}); // OK templated_fn<std::vector<int>>({1, 2, 3}); // also OK }"><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>vector<span class="pl-pds">></span></span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>initializer_list<span class="pl-pds">></span></span> <span class="pl-k">template </span><<span class="pl-k">class</span> <span class="pl-en">T</span>> <span class="pl-k">struct</span> <span class="pl-en">S</span> { std::vector<T> v; <span class="pl-en">S</span>(std::initializer_list<T> l) : v(l) { std::cout << <span class="pl-s"><span class="pl-pds">"</span>constructed with a <span class="pl-pds">"</span></span> << l.<span class="pl-c1">size</span>() << <span class="pl-s"><span class="pl-pds">"</span>-element list<span class="pl-cce">\n</span><span class="pl-pds">"</span></span>; } <span class="pl-k">void</span> <span class="pl-en">append</span>(std::initializer_list<T> l) { v.<span class="pl-c1">insert</span>(v.<span class="pl-c1">end</span>(), l.<span class="pl-c1">begin</span>(), l.<span class="pl-c1">end</span>()); } std::pair<<span class="pl-k">const</span> T*, std::<span class="pl-c1">size_t</span>> <span class="pl-en">c_arr</span>() <span class="pl-k">const</span> { <span class="pl-k">return</span> {&v[<span class="pl-c1">0</span>], v.<span class="pl-c1">size</span>()}; <span class="pl-c"><span class="pl-c">//</span> Copy the list initialization in the return statement</span> <span class="pl-c"><span class="pl-c">//</span> this does not use std :: initializer_list</span> } }; <span class="pl-k">template </span><<span class="pl-k">typename</span> T> <span class="pl-k">void</span> <span class="pl-en">templated_fn</span>(T) {} <span class="pl-k">int</span> <span class="pl-en">main</span>() { S<<span class="pl-k">int</span>> s = {<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>, <span class="pl-c1">5</span>}; <span class="pl-c"><span class="pl-c">//</span> copy initialization</span> s.<span class="pl-c1">append</span>({<span class="pl-c1">6</span>, <span class="pl-c1">7</span>, <span class="pl-c1">8</span>}); <span class="pl-c"><span class="pl-c">//</span> list initialization in function call</span> std::cout << <span class="pl-s"><span class="pl-pds">"</span>The vector size is now <span class="pl-pds">"</span></span> << s.<span class="pl-c1">c_arr</span>().<span class="pl-smi">second</span> << <span class="pl-s"><span class="pl-pds">"</span> ints:<span class="pl-cce">\n</span><span class="pl-pds">"</span></span>; <span class="pl-k">for</span> (<span class="pl-k">auto</span> n : s.<span class="pl-smi">v</span>) std::cout << n << <span class="pl-s"><span class="pl-pds">'</span> <span class="pl-pds">'</span></span>; std::cout << <span class="pl-s"><span class="pl-pds">'</span><span class="pl-cce">\n</span><span class="pl-pds">'</span></span>; std::cout << <span class="pl-s"><span class="pl-pds">"</span>Range-for over brace-init-list: <span class="pl-cce">\n</span><span class="pl-pds">"</span></span>; <span class="pl-k">for</span> (<span class="pl-k">int</span> x : {-<span class="pl-c1">1</span>, -<span class="pl-c1">2</span>, -<span class="pl-c1">3</span>}) <span class="pl-c"><span class="pl-c">//</span> auto rules make this band for work</span> std::cout << x << <span class="pl-s"><span class="pl-pds">'</span> <span class="pl-pds">'</span></span>; std::cout << <span class="pl-s"><span class="pl-pds">'</span><span class="pl-cce">\n</span><span class="pl-pds">'</span></span>; <span class="pl-k">auto</span> al = {<span class="pl-c1">10</span>, <span class="pl-c1">11</span>, <span class="pl-c1">12</span>}; <span class="pl-c"><span class="pl-c">//</span> special rules for auto</span> std::cout << <span class="pl-s"><span class="pl-pds">"</span>The list bound to auto has size() = <span class="pl-pds">"</span></span> << al.<span class="pl-c1">size</span>() << <span class="pl-s"><span class="pl-pds">'</span><span class="pl-cce">\n</span><span class="pl-pds">'</span></span>; <span class="pl-c"><span class="pl-c">//</span> templated_fn({1, 2, 3}); // Compile error! "{1, 2, 3}" is not an expression,</span> <span class="pl-c"><span class="pl-c">//</span> it has no type, so T cannot infer</span> templated_fn<std::initializer_list<<span class="pl-k">int</span>>>({<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>}); <span class="pl-c"><span class="pl-c">//</span> OK</span> templated_fn<std::vector<<span class="pl-k">int</span>>>({<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>}); <span class="pl-c"><span class="pl-c">//</span> also OK</span> }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Object-oriented</h3><a id="user-content-object-oriented" class="anchor" aria-label="Permalink: Object-oriented" href="#object-oriented"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Object-oriented programming (OOP) is a model of program programming with object concepts, and it is also an abstract approach to program development.</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E5%9F%BA%E6%9C%AC%E7%89%B9%E5%BE%81.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E5%9F%BA%E6%9C%AC%E7%89%B9%E5%BE%81.png" alt="Object-oriented features" style="max-width: 100%;"></a></p> <p dir="auto">Three Object-Oriented Features-Encapsulation, Inheritance, and Polymorphism</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Encapsulation</h3><a id="user-content-encapsulation" class="anchor" aria-label="Permalink: Encapsulation" href="#encapsulation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Encapsulate objective things into abstract classes, and classes can only use their own data and methods for trusted classes or objects to operate, and hide untrusted information. Keywords: public, protected, private. Do not write defaults to private.</p> <ul dir="auto"> <li><code>public</code> members: can be accessed by any entity</li> <li><code>protected</code> members: only allowed to be accessed by subclasses and member functions of this class</li> <li><code>private</code> members: only accessible by member functions, friend classes, or friend functions of this class</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Inheritance</h3><a id="user-content-inheritance" class="anchor" aria-label="Permalink: Inheritance" href="#inheritance"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Base class (parent class) ——> derived class (subclass)</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Polymorphism</h3><a id="user-content-polymorphism" class="anchor" aria-label="Permalink: Polymorphism" href="#polymorphism"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Polymorphism, that is, multiple states (morphology). In simple terms, we can define polymorphism as the ability of a message to be displayed in multiple forms.</li> <li>Polymorphism is based on encapsulation and inheritance.</li> <li>C polymorphism classification and implementation: <ol dir="auto"> <li>Ad-hoc Polymorphism (compile-time): function overload, operator overload</li> <li>Subtype Polymorphism (runtime): virtual function</li> <li>Parametric Polymorphism (compile-time): class template, function template</li> <li>Coercion Polymorphism (compilation / runtime): basic type conversion, custom type conversion</li> </ol> </li> </ul> <blockquote> <p dir="auto"><a href="https://catonmat.net/cpp-polymorphism" rel="nofollow">The Four Polymorphisms in C++</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Static polymorphism (compile time / early binding)</h4><a id="user-content-static-polymorphism-compile-time--early-binding" class="anchor" aria-label="Permalink: Static polymorphism (compile time / early binding)" href="#static-polymorphism-compile-time--early-binding"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Function overloading</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class A { public: void do(int a); void do(int a, int b); };"><pre><span class="pl-k">class</span> <span class="pl-en">A</span> { <span class="pl-k">public:</span> <span class="pl-k">void</span> <span class="pl-k">do</span>(<span class="pl-k">int</span> a); <span class="pl-k">void</span> <span class="pl-k">do</span>(<span class="pl-k">int</span> a, <span class="pl-k">int</span> b); };</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Dynamic polymorphism (runtime / late binding)</h4><a id="user-content-dynamic-polymorphism-runtime--late-binding" class="anchor" aria-label="Permalink: Dynamic polymorphism (runtime / late binding)" href="#dynamic-polymorphism-runtime--late-binding"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Virtual functions: decorate member functions with virtual to make them virtual</li> <li>Dynamic binding: dynamic binding occurs when a virtual function is called using a reference or pointer to a base class</li> </ul> <p dir="auto"><strong>note:</strong></p> <ul dir="auto"> <li>You can assign an object of a derived class to a pointer or reference of the base class, and not vice versa</li> <li>Ordinary functions (non-class member functions) cannot be virtual functions</li> <li>Static functions (static) cannot be virtual functions</li> <li>The constructor cannot be a virtual function (because when the constructor is called, the virtual table pointer is not in the object's memory space, the virtual table pointer must be formed after the constructor is called)</li> <li>An inline function cannot be a virtual function when it shows polymorphism. For an explanation, see: <a href="https://github.com/huihut/interview#%E8%99%9A%E5%87%BD%E6%95%B0virtual%E5%8F%AF%E4%BB%A5%E6%98%AF%E5%86%85%E8%81%94%E5%87%BD%E6%95%B0inline%E5%90%97">Can a virtual function be an inline function? </a></li> </ul> <p dir="auto">Dynamic polymorphic demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Shape // shape class { public: virtual double calcArea() { ... } virtual ~Shape(); }; class Circle : public Shape // circle class { public: virtual double calcArea(); ... }; class Rect : public Shape // rectangle class { public: virtual double calcArea(); ... }; int main() { Shape * shape1 = new Circle(4.0); Shape * shape2 = new Rect(5.0, 6.0); shape1->calcArea(); // call the method in the circular class shape2->calcArea(); // call the method in the rectangle class delete shape1; shape1 = nullptr; delete shape2; shape2 = nullptr; return 0; }"><pre><span class="pl-k">class</span> <span class="pl-en">Shape</span> <span class="pl-c"><span class="pl-c">//</span> shape class</span> { <span class="pl-k">public:</span> <span class="pl-k">virtual</span> <span class="pl-k">double</span> <span class="pl-en">calcArea</span>() { ... } <span class="pl-k">virtual</span> <span class="pl-en">~Shape</span>(); }; <span class="pl-k">class</span> <span class="pl-en">Circle</span> : <span class="pl-k">public</span> <span class="pl-en">Shape</span> <span class="pl-c"><span class="pl-c">//</span> circle class</span> { <span class="pl-k">public:</span> <span class="pl-k">virtual</span> <span class="pl-k">double</span> <span class="pl-en">calcArea</span>(); ... }; <span class="pl-k">class</span> <span class="pl-en">Rect</span> : <span class="pl-k">public</span> <span class="pl-en">Shape</span> <span class="pl-c"><span class="pl-c">//</span> rectangle class</span> { <span class="pl-k">public:</span> <span class="pl-k">virtual</span> <span class="pl-k">double</span> <span class="pl-en">calcArea</span>(); ... }; <span class="pl-k">int</span> <span class="pl-en">main</span>() { Shape * shape1 = <span class="pl-k">new</span> <span class="pl-c1">Circle</span>(<span class="pl-c1">4.0</span>); Shape * shape2 = <span class="pl-k">new</span> <span class="pl-c1">Rect</span>(<span class="pl-c1">5.0</span>, <span class="pl-c1">6.0</span>); shape1-><span class="pl-c1">calcArea</span>(); <span class="pl-c"><span class="pl-c">//</span> call the method in the circular class</span> shape2-><span class="pl-c1">calcArea</span>(); <span class="pl-c"><span class="pl-c">//</span> call the method in the rectangle class</span> <span class="pl-k">delete</span> shape1; shape1 = <span class="pl-c1">nullptr</span>; <span class="pl-k">delete</span> shape2; shape2 = <span class="pl-c1">nullptr</span>; <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Virtual destructor</h3><a id="user-content-virtual-destructor" class="anchor" aria-label="Permalink: Virtual destructor" href="#virtual-destructor"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The virtual destructor is to resolve the pointer of the base class to the derived class object, and delete the derived class object with the pointer of the base class.</p> <p dir="auto">Virtual destructor demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Shape { public: Shape(); // Constructor cannot be virtual virtual double calcArea(); virtual ~Shape(); // virtual destructor }; class Circle : public Shape // circle class { public: virtual double calcArea(); ... }; int main() { Shape * shape1 = new Circle(4.0); shape1->calcArea(); delete shape1; // Because Shape has a virtual destructor, when delete deletes the memory, it first calls the subclass destructor and then the base class destructor to prevent memory leaks. shape1 = NULL; return 0; }"><pre><span class="pl-k">class</span> <span class="pl-en">Shape</span> { <span class="pl-k">public:</span> <span class="pl-en">Shape</span>(); <span class="pl-c"><span class="pl-c">//</span> Constructor cannot be virtual</span> <span class="pl-k">virtual</span> <span class="pl-k">double</span> <span class="pl-en">calcArea</span>(); <span class="pl-k">virtual</span> <span class="pl-en">~Shape</span>(); <span class="pl-c"><span class="pl-c">//</span> virtual destructor</span> }; <span class="pl-k">class</span> <span class="pl-en">Circle</span> : <span class="pl-k">public</span> <span class="pl-en">Shape</span> <span class="pl-c"><span class="pl-c">//</span> circle class</span> { <span class="pl-k">public:</span> <span class="pl-k">virtual</span> <span class="pl-k">double</span> <span class="pl-en">calcArea</span>(); ... }; <span class="pl-k">int</span> <span class="pl-en">main</span>() { Shape * shape1 = <span class="pl-k">new</span> <span class="pl-c1">Circle</span>(<span class="pl-c1">4.0</span>); shape1-><span class="pl-c1">calcArea</span>(); <span class="pl-k">delete</span> shape1; <span class="pl-c"><span class="pl-c">//</span> Because Shape has a virtual destructor, when delete deletes the memory, it first calls the subclass destructor and then the base class destructor to prevent memory leaks.</span> shape1 = <span class="pl-c1">NULL</span>; <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Pure virtual functions</h3><a id="user-content-pure-virtual-functions" class="anchor" aria-label="Permalink: Pure virtual functions" href="#pure-virtual-functions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">A pure virtual function is a special kind of virtual function. You cannot give a meaningful implementation to a virtual function in a base class. Instead, you declare it as a pure virtual function. Its implementation is left to the derived classes of the base class.</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="virtual int A() = 0;"><pre><span class="pl-k">virtual</span> <span class="pl-k">int</span> <span class="pl-en">A</span>() = 0;</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Virtual functions, pure virtual functions</h3><a id="user-content-virtual-functions-pure-virtual-functions" class="anchor" aria-label="Permalink: Virtual functions, pure virtual functions" href="#virtual-functions-pure-virtual-functions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>If a virtual function is declared in the class, this function is implemented, even if it is empty, its role is to allow this function to be overridden in its subclasses, so that the compiler can use Late binding to achieve polymorphism. A pure virtual function is just an interface. It is a function declaration. It must be left in a subclass to implement it.</li> <li>Virtual functions can not be overridden in subclasses; but pure virtual functions must be implemented in subclasses to instantiate subclasses.</li> <li>The virtual function class is used for "implementation inheritance". Inheriting the interface also inherits the implementation of the parent class. Pure virtual functions focus on the uniformity of the interface, and the implementation is done by subclasses.</li> <li>A class with a pure virtual function is called an abstract class. This class cannot directly generate objects. It can only be used after being inherited and rewriting its virtual function. After an abstract class is inherited, subclasses can continue to be abstract or ordinary classes.</li> <li>Virtual base class is the base class in virtual inheritance, see below for details.</li> </ul> <blockquote> <p dir="auto"><a href="https://blog.csdn.net/u012260238/article/details/53610462" rel="nofollow">CSDN . C++ And connection of virtual functions and pure virtual functions</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Virtual function pointer, virtual function table</h3><a id="user-content-virtual-function-pointer-virtual-function-table" class="anchor" aria-label="Permalink: Virtual function pointer, virtual function table" href="#virtual-function-pointer-virtual-function-table"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Virtual function pointer: In an object containing a virtual function class, it points to a virtual function table, which is determined at runtime.</li> <li>Virtual function table: in the program read-only data section (<code>.rodata section</code>, see: <a href="#%E7%9B%AE%E6%A0%87%E6%96%87%E4%BB%B6%E5%AD%98%E5%82%A8%E7%BB%93%E6%9E%84">object file storage structure</a>),Stores virtual function pointers. If the derived class implements a virtual function of the base class, the virtual function pointer of the original base class is overwritten in the virtual table, and is created according to the class declaration at compile time.</li> </ul> <blockquote> <p dir="auto"><a href="https://blog.twofei.com/496/" rel="nofollow">C++ Function (table) implementation mechanism and simulation implementation in C language</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Virtual inheritance</h3><a id="user-content-virtual-inheritance" class="anchor" aria-label="Permalink: Virtual inheritance" href="#virtual-inheritance"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Virtual inheritance is used to solve the problem of diamond inheritance under multiple inheritance conditions (wasting storage space and ambiguity).</p> <p dir="auto">The underlying implementation principle is related to the compiler. It is generally implemented by ** virtual base class pointer ** and ** virtual base class table **. Each virtual inherited subclass has a virtual base class pointer (occupies the storage space of a pointer) , 4 bytes) and virtual base class table (does not occupy storage space of class objects) (It should be emphasized that the virtual base class will still have a copy in the subclass, but there is only one copy at most, not not in the subclass. Inside); when the subclass of virtual inheritance is inherited as the parent class, the pointer of the virtual base class will also be inherited.</p> <p dir="auto">In fact, vbptr refers to a virtual base table pointer. This pointer points to a virtual base table. The virtual table records the offset address of the virtual base class and this class. Offset address, so that the virtual base class members are found, and virtual inheritance does not need to maintain two identical copies of the public base class (virtual base class) like ordinary multiple inheritance, saving storage space.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Virtual inheritance, virtual functions</h3><a id="user-content-virtual-inheritance-virtual-functions" class="anchor" aria-label="Permalink: Virtual inheritance, virtual functions" href="#virtual-inheritance-virtual-functions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Similarities: Both use virtual pointers (both occupy class storage space) and virtual tables (both do not occupy class storage space)</li> <li>the difference: <ul dir="auto"> <li>Virtual inheritance <ul dir="auto"> <li>The virtual base class still exists in the inherited class and only takes up storage space</li> <li>The virtual base class table stores the offset of the virtual base class relative to the direct inherited class</li> </ul> </li> <li>Virtual function <ul dir="auto"> <li>Virtual functions do not take up storage space</li> <li>The virtual function table stores the virtual function address</li> </ul> </li> </ul> </li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Template classes, member templates, virtual functions</h3><a id="user-content-template-classes-member-templates-virtual-functions" class="anchor" aria-label="Permalink: Template classes, member templates, virtual functions" href="#template-classes-member-templates-virtual-functions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Virtual functions can be used in template classes</li> <li>The member template of a class (whether it is a normal class or a class template) (it is a member function of the template) cannot be a virtual function</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Abstract class, interface class, aggregate class</h3><a id="user-content-abstract-class-interface-class-aggregate-class" class="anchor" aria-label="Permalink: Abstract class, interface class, aggregate class" href="#abstract-class-interface-class-aggregate-class"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Abstract class: a class containing pure virtual functions</li> <li>Interface class: Abstract class containing only pure virtual functions</li> <li>Aggregation classes: Users can directly access their members and have a special form of initialization syntax. Meet the following characteristics: <ul dir="auto"> <li>All members are public</li> <li>No constructor is defined</li> <li>No in-class initialization</li> <li>No base class, no virtual function</li> </ul> </li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Memory allocation and management</h3><a id="user-content-memory-allocation-and-management" class="anchor" aria-label="Permalink: Memory allocation and management" href="#memory-allocation-and-management"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">malloc, calloc, realloc, alloca</h4><a id="user-content-malloc-calloc-realloc-alloca" class="anchor" aria-label="Permalink: malloc, calloc, realloc, alloca" href="#malloc-calloc-realloc-alloca"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>malloc: apply for a specified number of bytes of memory. The initial value in the requested memory is uncertain.</li> <li>calloc: For an object of a specified length, allocate memory that can hold the specified number of objects. Each bit of the requested memory is initialized to 0.</li> <li>realloc: change the previously allocated memory length (increase or decrease). When increasing the length, it may be necessary to move the contents of the previously allocated area to another sufficiently large area, while the initial value in the newly added area is uncertain.</li> <li>alloca: apply for memory on the stack. When the program pops out of the stack, it will automatically release memory. However, it should be noted that alloca is not portable and difficult to implement on machines without traditional stacks. alloca should not be used in programs that must be widely ported. C99 supports variable-length arrays (VLAs) and can be used instead of alloca.</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">malloc, free</h4><a id="user-content-malloc-free" class="anchor" aria-label="Permalink: malloc, free" href="#malloc-free"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Used to allocate and release memory</p> <p dir="auto">malloc, free use</p> <p dir="auto">Apply for memory and confirm whether the application is successful</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="char *str = (char*) malloc(100); assert(str != nullptr);"><pre><span class="pl-k">char</span> *str = (<span class="pl-k">char</span>*) malloc(<span class="pl-c1">100</span>); <span class="pl-en">assert</span>(str != <span class="pl-c1">nullptr</span>);</pre></div> <p dir="auto">Pointer is empty after freeing memory</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="free(p); p = nullptr;"><pre><span class="pl-en">free</span>(p); p = <span class="pl-c1">nullptr</span>;</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">new、delete</h4><a id="user-content-newdelete" class="anchor" aria-label="Permalink: new、delete" href="#newdelete"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>new / new []: Do two things, first call malloc at the bottom to allocate memory, and then call the constructor (create the object).</li> <li>delete / delete []: also complete two things, first call the destructor (clean up resources), and then call free to free up space at the bottom.</li> <li>new automatically calculates the number of bytes required when applying for memory, and malloc requires us to enter the number of bytes of the requested memory space ourselves.</li> </ol> <p dir="auto">new, delete demo</p> <p dir="auto">Apply for memory and confirm whether the application is successful</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="int main() { T* t = new T(); // memory allocation first, then constructor delete t; // destructor first, then release memory return 0; }"><pre><span class="pl-k">int</span> <span class="pl-en">main</span>() { T* t = <span class="pl-k">new</span> <span class="pl-c1">T</span>(); <span class="pl-c"><span class="pl-c">//</span> memory allocation first, then constructor</span> <span class="pl-k">delete</span> t; <span class="pl-c"><span class="pl-c">//</span> destructor first, then release memory</span> <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Positioning new</h4><a id="user-content-positioning-new" class="anchor" aria-label="Permalink: Positioning new" href="#positioning-new"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Positioning new (placement new) allows us to pass additional address parameters to new to create objects in a pre-specified memory area.</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="new (place_address) type new (place_address) type (initializers) new (place_address) type [size] new (place_address) type [size] { braced initializer list }"><pre><span class="pl-k">new</span> (place_address) type <span class="pl-k">new</span> (place_address) type (initializers) <span class="pl-k">new</span> (place_address) type [size] <span class="pl-k">new</span> (place_address) type [size] { braced initializer list }</pre></div> <ul dir="auto"> <li><code>place_address</code> is a pointer</li> <li><code>initializers</code> provides a (possibly empty) comma-separated list of initial values</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">delete this - Is it legal?</h3><a id="user-content-delete-this---is-it-legal" class="anchor" aria-label="Permalink: delete this - Is it legal?" href="#delete-this---is-it-legal"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto"><a href="https://isocpp.org/wiki/faq/freestore-mgmt#delete-this" rel="nofollow">Is it legal (and moral) for a member function to say delete this?</a></p> </blockquote> <p dir="auto">Legal, but:</p> <ol dir="auto"> <li>It must be guaranteed that this object is allocated via <code>new</code> (not <code>new[]</code>, not placement new, not on the stack, not global, not a member of other objects)</li> <li>You must ensure that the member function that calls delete this is the last member function that calls this</li> <li>You must ensure that the member function does not call this after <code>delete this</code></li> <li>Make sure no one uses it after delete this</li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">How to define a class that can only generate objects on the heap (on the stack)?</h3><a id="user-content-how-to-define-a-class-that-can-only-generate-objects-on-the-heap-on-the-stack" class="anchor" aria-label="Permalink: How to define a class that can only generate objects on the heap (on the stack)?" href="#how-to-define-a-class-that-can-only-generate-objects-on-the-heap-on-the-stack"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto"><a href="https://www.nowcoder.com/questionTerminal/0a584aa13f804f3ea72b442a065a7618" rel="nofollow">How to define a class that can only generate objects on the heap (on the stack)?</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Only on the heap</h4><a id="user-content-only-on-the-heap" class="anchor" aria-label="Permalink: Only on the heap" href="#only-on-the-heap"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Method: Make the destructor private</p> <p dir="auto">Reason: C ++ is a static binding language. The compiler manages the life cycle of objects on the stack. When the compiler allocates stack space for class objects, it first checks the accessibility of the class's destructor. If the destructor is not accessible, the object cannot be created on the stack.</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Only on the stack</h4><a id="user-content-only-on-the-stack" class="anchor" aria-label="Permalink: Only on the stack" href="#only-on-the-stack"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Method: overload new and delete as private</p> <p dir="auto">Reason: The object is generated on the heap using the new keyword operation. The process is divided into two stages: the first stage uses new to find available memory on the heap and allocates it to the object; the second stage calls the constructor to generate the object. By setting the new operation to private, the first phase cannot be completed, and objects cannot be generated on the heap.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Smart pointer</h3><a id="user-content-smart-pointer" class="anchor" aria-label="Permalink: Smart pointer" href="#smart-pointer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">In the C ++ Standard Library (STL)</h4><a id="user-content-in-the-c--standard-library-stl" class="anchor" aria-label="Permalink: In the C ++ Standard Library (STL)" href="#in-the-c--standard-library-stl"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">header file:<code>#include <memory></code></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">C++ 98</h4><a id="user-content-c-98" class="anchor" aria-label="Permalink: C++ 98" href="#c-98"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="std::auto_ptr<std::string> ps (new std::string(str));"><pre>std::auto_ptr<std::string> <span class="pl-en">ps</span> (<span class="pl-k">new</span> std::string(str));</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">C++ 11</h4><a id="user-content-c-11" class="anchor" aria-label="Permalink: C++ 11" href="#c-11"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>shared_ptr</li> <li>unique_ptr</li> <li>weak_ptr</li> <li>auto_ptr (Deprecated by C ++ 11)</li> </ol> <ul dir="auto"> <li>Class shared_ptr implements the concept of shared ownership. Multiple smart pointers point to the same object, and that object and its associated resources are released when the "last reference is destroyed". In order to perform the above work in more complex scenarios, the standard library provides auxiliary classes such as weak_ptr, bad_weak_ptr, and enable_shared_from_this.</li> <li>Class unique_ptr implements the concept of exclusive ownership or strict ownership, ensuring that only one smart pointer can point to the object at a time. You can transfer ownership. It is especially useful for avoiding resource leaks, such as forgetting to delete after new.</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">shared_ptr</h5><a id="user-content-shared_ptr" class="anchor" aria-label="Permalink: shared_ptr" href="#shared_ptr"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Multiple smart pointers can share the same object, and the last one of the object has the responsibility to destroy the object and clean up all resources related to the object.</p> <ul dir="auto"> <li>Support custom deleter, which can prevent Cross-DLL problems (object is created by new in dynamic link library (DLL), but deleted by another DLL), and the mutex is automatically released</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">weak_ptr</h5><a id="user-content-weak_ptr" class="anchor" aria-label="Permalink: weak_ptr" href="#weak_ptr"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">weak_ptr allows you to share but does not own an object. Once the last smart pointer that owns the object loses ownership, any weak_ptr will automatically become empty. Therefore, in addition to the default and copy constructors, weak_ptr only provides a "accept a shared_ptr" constructor.</p> <ul dir="auto"> <li>The problem of cycles of references (two objects that have not been used actually refer to each other, making them appear to be in the "used" state)</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">unique_ptr</h5><a id="user-content-unique_ptr" class="anchor" aria-label="Permalink: unique_ptr" href="#unique_ptr"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">unique_ptr is a type that has only been available since C ++ 11, and is a smart pointer that can help avoid resource leaks during exceptions. Using exclusive ownership means that you can ensure that an object and its corresponding resource are owned by only one pointer at a time. Once you own the destroyed or programmed empty, or start owning another object, the previously owned object will be destroyed and any corresponding resources will be released.</p> <ul dir="auto"> <li>unique_ptr is used instead of auto_ptr</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">auto_ptr</h5><a id="user-content-auto_ptr" class="anchor" aria-label="Permalink: auto_ptr" href="#auto_ptr"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Deprecated by c ++ 11 due to lack of language features such as <code>std::move</code> semantics "for construction and assignment", and other flaws.</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">auto_ptr compared to unique_ptr</h5><a id="user-content-auto_ptr-compared-to-unique_ptr" class="anchor" aria-label="Permalink: auto_ptr compared to unique_ptr" href="#auto_ptr-compared-to-unique_ptr"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>auto_ptr can be assigned a copy, and ownership is transferred after copying; unqiue_ptr has no copy assignment semantics, but implements <code>move</code> semantics;</li> <li>auto_ptr objects cannot manage arrays (destructive call <code>delete</code>), unique_ptr can manage arrays (destructive call<code>delete []</code>);</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Casting Operator</h3><a id="user-content-casting-operator" class="anchor" aria-label="Permalink: Casting Operator" href="#casting-operator"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto"><a href="https://msdn.microsoft.com/zh-CN/library/5f6c9f8h.aspx" rel="nofollow">MSDN. Casting Operator</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">static_cast</h4><a id="user-content-static_cast" class="anchor" aria-label="Permalink: static_cast" href="#static_cast"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>For non-polymorphic conversions</li> <li>Do not perform runtime type checking (conversion security is not as good as dynamic_cast)</li> <li>Usually used to convert numeric data types (such as float-> int)</li> <li>You can move the pointer throughout the class hierarchy. It is safe (upward conversion) for a child class to be converted to a parent class, and it is not safe to convert a parent class to a child class (because a child class may have fields or methods that are not in the parent class)</li> </ul> <blockquote> <p dir="auto">Upcast is an implicit conversion.</p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">dynamic_cast</h4><a id="user-content-dynamic_cast" class="anchor" aria-label="Permalink: dynamic_cast" href="#dynamic_cast"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>For polymorphic type conversions</li> <li>Perform line runtime type checking</li> <li>Only applicable to pointers or references</li> <li>Conversion of ambiguous pointers will fail (return nullptr), but no exception will be thrown</li> <li>You can move the pointer throughout the class hierarchy, including up conversion, down conversion</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">const_cast</h4><a id="user-content-const_cast" class="anchor" aria-label="Permalink: const_cast" href="#const_cast"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Used to remove const, volatile, and __unaligned features (such as converting const int to int)</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">reinterpret_cast</h4><a id="user-content-reinterpret_cast" class="anchor" aria-label="Permalink: reinterpret_cast" href="#reinterpret_cast"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Simple reinterpretation for bits</li> <li>Misuse of the reinterpret_cast operator can be very risky. Unless the required conversion itself is low-level, you should use one of the other cast operators.</li> <li>Allows conversion of any pointer to any other pointer type (such as <code>char *</code> to <code>int *</code> or <code>One_class *</code> to <code>Unrelated_class *</code>, but it is not itself safe)</li> <li>Also allows conversion of any integer type to any pointer type and reverse conversion.</li> <li>The reinterpret_cast operator cannot lose const, volatile, or __unaligned attributes.</li> <li>A practical use of reinterpret_cast is in a hash function, which is to map values to indexes by making two different values hardly end with the same index.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">bad_cast</h4><a id="user-content-bad_cast" class="anchor" aria-label="Permalink: bad_cast" href="#bad_cast"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>The dynamic_cast operator throws a bad_cast exception because the cast to a reference type fails.</li> </ul> <p dir="auto">bad_cast demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="try { Circle& ref_circle = dynamic_cast<Circle&>(ref_shape); } catch (bad_cast b) { cout << "Caught: " << b.what(); } "><pre><span class="pl-k">try</span> { Circle& ref_circle = <span class="pl-k">dynamic_cast</span><Circle&>(ref_shape); } <span class="pl-k">catch</span> (bad_cast b) { cout << <span class="pl-s"><span class="pl-pds">"</span>Caught: <span class="pl-pds">"</span></span> << b.<span class="pl-c1">what</span>(); } </pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Runtime Type Information (RTTI)</h3><a id="user-content-runtime-type-information-rtti" class="anchor" aria-label="Permalink: Runtime Type Information (RTTI)" href="#runtime-type-information-rtti"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">dynamic_cast</h4><a id="user-content-dynamic_cast-1" class="anchor" aria-label="Permalink: dynamic_cast" href="#dynamic_cast-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>For polymorphic type conversions</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">typeid</h4><a id="user-content-typeid" class="anchor" aria-label="Permalink: typeid" href="#typeid"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>The typeid operator allows determining the type of an object at runtime</li> <li>type \ _id returns a reference to a type \ _info object</li> <li>If you want to get the data type of the derived class through the pointer of the base class, the base class must have a virtual function</li> <li>Can only get the actual type of the object</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">type_info</h4><a id="user-content-type_info" class="anchor" aria-label="Permalink: type_info" href="#type_info"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>The type_info class describes the type information generated by the compiler in the program. Objects of this class can effectively store pointers to the names of types. The type_info class can also store encoded values suitable for comparing whether two types are equal or comparing their permutation order. The encoding rules and permutation order for the types are unspecified and may vary from program to program.</li> <li>Header file: <code>typeinfo</code></li> </ul> <p dir="auto">typeid, type_info demo</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include <iostream> using namespace std; class Flyable // can fly { public: virtual void takeoff() = 0; // take off virtual void land() = 0; // land }; class Bird : public Flyable // bird { public: void foraging() {...} // foraging virtual void takeoff() {...} virtual void land() {...} virtual ~Bird(){} }; class Plane : public Flyable // airplane { public: void carry() {...} // carry virtual void takeoff() {...} virtual void land() {...} }; class type_info { public: const char* name() const; bool operator == (const type_info & rhs) const; bool operator != (const type_info & rhs) const; int before(const type_info & rhs) const; virtual ~type_info(); private: ... }; void doSomething(Flyable *obj) // do something { obj->takeoff(); cout << typeid(*obj).name() << endl; // output the type of the incoming object("class Bird" or "class Plane") if(typeid(*obj) == typeid(Bird)) // determine object type { Bird *bird = dynamic_cast<Bird *>(obj); // object conversion bird->foraging(); } obj->land(); } int main(){ Bird *b = new Bird(); doSomething(b); delete b; b = nullptr; return 0; }"><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span> <span class="pl-k">using</span> <span class="pl-k">namespace</span> <span class="pl-en">std</span><span class="pl-k">;</span> <span class="pl-k">class</span> <span class="pl-en">Flyable</span> <span class="pl-c"><span class="pl-c">//</span> can fly</span> { <span class="pl-k">public:</span> <span class="pl-k">virtual</span> <span class="pl-k">void</span> <span class="pl-en">takeoff</span>() = 0; <span class="pl-c"><span class="pl-c">//</span> take off</span> <span class="pl-k">virtual</span> <span class="pl-k">void</span> <span class="pl-en">land</span>() = 0; <span class="pl-c"><span class="pl-c">//</span> land</span> }; <span class="pl-k">class</span> <span class="pl-en">Bird</span> : <span class="pl-k">public</span> <span class="pl-en">Flyable</span> <span class="pl-c"><span class="pl-c">//</span> bird</span> { <span class="pl-k">public:</span> <span class="pl-k">void</span> <span class="pl-en">foraging</span>() {...} <span class="pl-c"><span class="pl-c">//</span> foraging</span> <span class="pl-k">virtual</span> <span class="pl-k">void</span> <span class="pl-en">takeoff</span>() {...} <span class="pl-k">virtual</span> <span class="pl-k">void</span> <span class="pl-en">land</span>() {...} <span class="pl-k">virtual</span> <span class="pl-en">~Bird</span>(){} }; <span class="pl-k">class</span> <span class="pl-en">Plane</span> : <span class="pl-k">public</span> <span class="pl-en">Flyable</span> <span class="pl-c"><span class="pl-c">//</span> airplane</span> { <span class="pl-k">public:</span> <span class="pl-k">void</span> <span class="pl-en">carry</span>() {...} <span class="pl-c"><span class="pl-c">//</span> carry</span> <span class="pl-k">virtual</span> <span class="pl-k">void</span> <span class="pl-en">takeoff</span>() {...} <span class="pl-k">virtual</span> <span class="pl-k">void</span> <span class="pl-en">land</span>() {...} }; <span class="pl-k">class</span> <span class="pl-en">type_info</span> { <span class="pl-k">public:</span> <span class="pl-k">const</span> <span class="pl-k">char</span>* <span class="pl-en">name</span>() <span class="pl-k">const</span>; <span class="pl-k">bool</span> <span class="pl-k">operator</span> == (<span class="pl-k">const</span> type_info & rhs) <span class="pl-k">const</span>; <span class="pl-k">bool</span> <span class="pl-k">operator</span> != (<span class="pl-k">const</span> type_info & rhs) <span class="pl-k">const</span>; <span class="pl-k">int</span> <span class="pl-en">before</span>(<span class="pl-k">const</span> type_info & rhs) <span class="pl-k">const</span>; <span class="pl-k">virtual</span> <span class="pl-en">~type_info</span>(); <span class="pl-k">private:</span> ... }; <span class="pl-k">void</span> <span class="pl-en">doSomething</span>(Flyable *obj) <span class="pl-c"><span class="pl-c">//</span> do something</span> { obj-><span class="pl-c1">takeoff</span>(); cout << <span class="pl-c1">typeid</span>(*obj).<span class="pl-c1">name</span>() << endl; <span class="pl-c"><span class="pl-c">//</span> output the type of the incoming object("class Bird" or "class Plane")</span> <span class="pl-k">if</span>(<span class="pl-c1">typeid</span>(*obj) == <span class="pl-c1">typeid</span>(Bird)) <span class="pl-c"><span class="pl-c">//</span> determine object type</span> { Bird *bird = <span class="pl-k">dynamic_cast</span><Bird *>(obj); <span class="pl-c"><span class="pl-c">//</span> object conversion</span> bird-><span class="pl-c1">foraging</span>(); } obj-><span class="pl-c1">land</span>(); } <span class="pl-k">int</span> <span class="pl-en">main</span>(){ Bird *b = <span class="pl-k">new</span> <span class="pl-c1">Bird</span>(); <span class="pl-c1">doSomething</span>(b); <span class="pl-k">delete</span> b; b = <span class="pl-c1">nullptr</span>; <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <p dir="auto"><a id="user-content-effective"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">⭐️ Effective</h2><a id="user-content-️-effective" class="anchor" aria-label="Permalink: ⭐️ Effective" href="#️-effective"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Effective C++</h3><a id="user-content-effective-c" class="anchor" aria-label="Permalink: Effective C++" href="#effective-c"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Treat C ++ as a language federation (C, Object-Oriented C ++, Template C ++, STL)</li> <li>It is better to replace the preprocessor with a compiler (try to replace <code># define</code> with <code>const</code>, <code>enum</code>, <code>inline</code>)</li> <li>Use const whenever possible</li> <li>Make sure that the object has been initialized before being used (the copy constructor is more efficient than the default copy assignment after construction)</li> <li>Understand what functions C ++ silently writes and calls (the compiler secretly creates a default constructor, copy constructor, copy assignment operator, destructor for class)</li> <li>If you don't want to use the automatically generated function of the compiler, you should explicitly reject it (declare member functions that you don't want to use as private and do not implement them)</li> <li>Declare a virtual destructor for the polymorphic base class (if the class has any virtual functions, it should have a virtual destructor)</li> <li>Don't let the exception escape the destructor (the destructor should swallow and not propagate the exception, or end the program, instead of spitting out the exception; if you want to handle the exception, you should handle it in a non-destructed ordinary function)</li> <li>Never call virtual functions during construction and destruction (because such calls never descend to the derived class)</li> <li>Let <code>operator =</code> return a <code>reference to * this</code> (for chained assignment)</li> <li>Handle "self-assignment" in <code>operator =</code></li> <li>When assigning an object, be sure to copy "all member variables within the object" and "all base class components" (call the base class copy constructor)</li> <li>Manage resources by objects (resources are obtained in the constructor and released in the destructor. It is recommended to use smart pointers. The resource acquisition time is the initialization time (Resource Acquisition Is Initialization (RAII)).</li> <li>Be careful with copying behavior in resource management classes (the general RAII class copying behavior is: inhibit copying, reference counting, deep copying, transfer of bottom resource ownership (similar to auto_ptr))</li> <li>Provide access to raw resources in the resource management class (access to raw resources may be explicitly or implicitly converted, in general, display conversion is safer, and implicit conversion is more convenient for customers)</li> <li>Use the same form when using new and delete in pairs (<code>[]</code> in <code>new</code> then<code> delete []</code>, <code>new</code> without <code>[]</code> and <code>delete</code>)</li> <li>Store the newed object in (into) a smart pointer in a separate statement (if you do not do this, it may cause undetectable resource leaks due to compiler optimizations)</li> <li>Make interfaces easy to use correctly and not easy to be misused (Promote normal use: Consistency of interfaces, compatible behavior of built-in types; Prevent misuse: Create new types, Restrict operation on types, Constrain object values Eliminate the client's resource management responsibilities)</li> <li>Designing a class is like designing a type, and you need to consider object creation, destruction, initialization, assignment, value passing, legal values, inheritance relationships, conversion, generalization, and so on.</li> <li>Prefer pass-by-reference-to-const instead of pass-by-value (the former is usually more efficient and avoids slicing problems, but not applicable to built-in types, STL iterators, function objects)</li> <li>When an object must be returned, do not deliberately return its reference (never return pointer or reference to a local stack object, or return reference to a heap-allocated object, or return pointer or reference to a local static object, which may be required at the same time. Multiple such objects.)</li> <li>Declare member variables as private (for encapsulation, consistency, precise control over reads and writes, etc.)</li> <li>Rather replace the member function with non-member and non-friend (which can increase packaging flexibility, packaging flexibility, and functional extensibility)</li> <li>If all parameters (including the metaphoric parameter pointed to by this pointer) require type conversion, please use a non-member function for this</li> <li>Consider writing a swap function that does not throw exceptions</li> <li>Delay the appearance of variable definitions as much as possible (to increase program clarity and improve program efficiency)</li> <li>Do as few transformations as possible (old: <code>(T) expression</code>,<code>T (expression)</code>; new:<code>const_cast <T> (expression)</code>,<code>dynamic_cast <T> (expression)</code>,<code>reinterpret_cast <T > (expression)</code>,<code>static_cast <T> (expression)</code>;; try to avoid transformation, pay attention to efficiency and avoid dynamic_casts, try to design so that no transformation is needed, the transformation can be encapsulated into a function, rather a new type of transformation is preferred)</li> <li>Avoid using handles (including references, pointers, iterators) to point inside the object (to increase encapsulation, make const member functions behave more like const, and reduce "dangling handles" (such as dangling pointers, etc.) possibility)</li> <li>It is worthwhile to work for "exception safety" (Exception-safe functions) will not leak resources or allow any data structure to break even if an exception occurs. There are three possible guarantees: basic, strong Type, do not throw abnormal type)</li> <li>Thorough understanding of inlining inside and outside (inlining is a compile-time behavior in most C ++ programs; whether an inline function is really inline depends on the compiler; most compilers refuse to be too complex (such as with loops or recursion) ) Function inlining, and all calls to virtual functions (unless they are the most bland) will also cause inlining to fail; the code expansion caused by inline may cause a loss of efficiency; inline functions cannot be upgraded with the upgrade of the library)</li> <li>Minimize the compilation dependencies between files (if you can use object references or object pointers to complete the task, do not use objects; if possible, try to replace class definitions with class declarations; provide differences between declarative and definitions Header file)</li> <li>Make sure your public inheritance moulds out an is-a (is a) relationship (applicable to everything in base classes must apply to derived classes, because every derived class object is also a base class object )</li> <li>Avoid obscuring inherited names (you can use using declarative or forwarding functions to make the obscure names goodbye)</li> <li>Distinguish between interface inheritance and implementation inheritance (under public inheritance, derived classes always inherit the interface of the base class; pure virtual functions only specify interface inheritance; non-pure virtual virtual functions specify interface inheritance and default implementation inheritance; non -virtual function specifies interface inheritance and mandatory implementation inheritance)</li> <li>Consider alternatives to virtual functions (such as the non-virtual interface (NVI) approach of the Template Method design pattern, replacing virtual functions with "function pointer member variables" and replacing virtual functions with <code>tr1 :: function</code> member variables, Replace the virtual function in the inheritance system with another virtual function in the inheritance system)</li> <li>Never redefine inherited non-virtual functions</li> <li>Never redefine inherited default parameter values, because the default parameter value is statically bound (statically bound), but the virtual function is dynamically bound (dynamically bound)</li> <li>Through compound molding has-a (one) or "implemented according to something" (in the application domain, compound means has-a (there is one); in the implementation domain, compound means (Is-implemented-in-terms-of)</li> <li>Use private inheritance wisely and prudently (private inheritance means is-implemented-in-terms-of (implemented according to something)), use composite whenever possible, when the derived class needs to access the members of the protected base class, or needs to re- Use private inheritance when defining inherited virtual functions, or when empty base optimization is required)</li> <li>Use multiple inheritance wisely and prudently (multiple inheritance is more complex than single inheritance, may lead to new ambiguities, and the need for virtual inheritance, but it does have a legitimate purpose, such as "public inheritance of an interface class" and "private inheritance A class that assists implementation "; virtual inheritance can solve the ambiguity of diamond inheritance under multiple inheritance, but it will increase the size, speed, complexity of initialization and assignment, etc.)</li> <li>Understand implicit interfaces and compile-time polymorphism (both classes and templates support interfaces and polymorphism); class interfaces are explicit with signatures as the center, and polymorphism is through virtual Functions occur at runtime; the interface of a template is implicit based on valid expressions, and polymorphism occurs through comprehension of templates and function overloading resolution at compile time)</li> <li>Understand the double meaning of typename (declared that the template type parameter is that the meaning of the prefix keywords class and typename are exactly the same; use the keyword typename to identify the nested dependent type name, but not in the base class lists or members Use it as a base class modifier in the member initialization list)</li> <li>Learn to deal with the names in templated base classes (you can refer to the member names in base class templates via <code>this-></code> in derived class templates, or by a clearly written "base class qualification modifier" )</li> <li>Extract parameter-independent code from templates (code bloat caused by non-type template parameters can often be eliminated by replacing template parameters with function parameters or class member variables; because of type parameters The resulting code bloat can often be achieved by having implementation types with identical binary representations share implementation codes)</li> <li>Use member function templates to accept all compatible types (please use member function templates to generate functions that "accept all compatible types"; declare member templates for "generalized copy construction" or "generalized assignment operation" Also need to declare the normal copy constructor and copy assignment operator)</li> <li>When you need type conversion, please define non-member functions for the template (when we write a class template, and the "relevant to this template" function provided by it supports "implicit type conversion of all parameters", please those functions Defined as "friend function inside class template")</li> <li>Please use traits classes to represent type information (traits classes use templates and "templates specialization" to make "type-related information" available at compile time, and use overloading (overloading) to implement if ... else on types at compile time test)</li> <li>Recognize template metaprogramming (TMP, template metaprogramming)</li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">More Effective c++</h3><a id="user-content-more-effective-c" class="anchor" aria-label="Permalink: More Effective c++" href="#more-effective-c"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Carefully distinguish between pointers and references (when you know that you need to point to something and never change to point to other things, or when you implement an operator whose syntax requirements cannot be met by pointers, you should choose references; At any other time, use pointers)</li> <li>It is best to use C ++ cast operators (<code>static_cast</code>, <code>const_cast</code>, <code>dynamic_cast</code>, <code>reinterpret_cast</code>)</li> <li>Never polymorphically treat arrays (polymorphism and pointer arithmetic cannot be mixed; array objects almost always involve pointer arithmetic, so arrays and polymorphism should not be mixed)</li> <li>Don't provide default constructor if necessary (to avoid fields in the object being initialized meaninglessly)</li> <li>Be alert to custom "type conversion functions" (single argument constructors can be avoided by simple methods (explicit keywords) or proxy classes); implicit type conversion operators can be changed to explicit Member function to avoid unexpected behavior)</li> <li>Distinguish the prefix and postfix forms of the increment / decrement operator (pre-accumulate and take out and return a reference; post-preparation take and accumulate and return a const object; when processing user-defined types Should use pre-increment as much as possible; post-implementation should be based on its pre-brother)</li> <li>Never overload the <code>&&</code>, <code>||</code>, and <code>,</code> operators (<code>&&</code> and <code>||</code> overloading will replace “sudden-semantic semantics” with “function call semantics”; <code>The overload of</code> does not guarantee that the left expression must be evaluated earlier than the right expression)</li> <li>Understand the different meanings of new and delete ( <code>new operator</code>, <code>operator new</code>, <code>placement new</code>, <code>operator new[]</code> ; <code>delete operator</code>, <code>operator delete</code>, <code>destructor</code>, <code>operator delete[]</code> )</li> <li>Use destructors to avoid leaking resources (freeing resources when destructors can avoid resource leaks during exceptions)</li> <li>Prevent resource leaks in constructors (because C ++ will only destruct objects that have already been constructed, the constructor can use try ... catch or auto_ptr (and similar classes) to handle resource leaks when exceptions occur)</li> <li>Prohibit exceptions from flowing out of destructors (reason: first, avoid the terminate function being called in the stack-unwinding mechanism of exception propagation; second, help ensure that destructors complete everything they should do)</li> <li>Understand the difference between "throwing an exception" and "passing a parameter" or "calling a virtual function" (first, exception objects are always copied (except by pointer), if you catch even by value It is copied twice, but the object passed to the function parameter does not necessarily have to be copied. Second, the object that is "thrown as exceptions" has fewer allowed type conversion actions than the object "passed to the function"; Third, the catch clause is checked by the compiler for its "order in which it appears in the source code". The first match succeeds and is executed, and a virtual function is called. Function "</li> <li>Capture exceptions by by reference (to avoid the problem of object deletion and cutting of exception objects, retain the ability to catch standard exceptions, and restrict the number of times an exception object needs to be copied)</li> <li>Use exception specifications wisely (exception specifications provide an excellent description of what kind of exceptions a function expects to throw; there are also some disadvantages, including that the compiler only checks them locally and is easy to inadvertently violate them. Prevent higher-level exception handlers from handling unexpected exceptions)</li> <li>Understand the cost of exception handling (roughly estimated, if try block is used, the overall code will expand by about 5% -10%, and the execution speed will also decrease by this number; therefore, please limit your use of try block and exception specifications Must-use locations, and throw exceptions only in case of real exceptions)</li> <li>Keep in mind the 80-20 rule (the overall performance of software is almost always determined by a small part of its constituent elements (codes), and the code that consumes resources can be identified using a program profiler)</li> <li>Consider using lazy evaluation (can be applied to: Reference Counting to avoid unnecessary object copying, distinguish read and write actions of operator [] to do different things, Lazy Fetching (easy (Remove) to avoid unnecessary database reads, and Lazy Expression Evaluation (to avoid unnecessary numerical calculations)</li> <li>Amortize the expected computational cost (when you must support certain operations whose structure is almost always required, or when the results are often required multiple times, over-eager evaluation can improve program efficiency )</li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Google C ++ Style Guide</h3><a id="user-content-google-c--style-guide" class="anchor" aria-label="Permalink: Google C ++ Style Guide" href="#google-c--style-guide"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>English: <a href="https://google.github.io/styleguide/cppguide.html" rel="nofollow">Google C ++ Style Guide</a></li> <li>Chinese: <a href="https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/contents/" rel="nofollow">C ++ Style Guide</a></li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Other</h3><a id="user-content-other" class="anchor" aria-label="Permalink: Other" href="#other"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="http://www.stroustrup.com/bs_faq.html" rel="nofollow">Bjarne Stroustrup FAQ</a></li> <li><a href="http://www.stroustrup.com/bs_faq2.html" rel="nofollow">C ++ style and trick FAQ for Bjarne Stroustrup</a></li> </ul> <p dir="auto"><a id="user-content-stl"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">📦 STL</h2><a id="user-content--stl" class="anchor" aria-label="Permalink: 📦 STL" href="#-stl"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">STL index</h3><a id="user-content-stl-index" class="anchor" aria-label="Permalink: STL index" href="#stl-index"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="https://github.com/huihut/interview/tree/master/STL">STL Method Meaning Index</a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">STL container</h3><a id="user-content-stl-container" class="anchor" aria-label="Permalink: STL container" href="#stl-container"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Container</th> <th>Underlying data structure</th> <th>Time complexity</th> <th>Unordered</th> <th>Can not be repeated</th> <th>Other</th> </tr> </thead> <tbody> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#array">array</a></td> <td>array</td> <td>random read and change O(1)</td> <td>unordered</td> <td>repeatable</td> <td>support random access</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#vector">vector</a></td> <td>Array</td> <td>Random read, tail insertion, tail deletion O(1) <br> head insertion, head Delete O(n)</td> <td>Unordered</td> <td>Repeatable</td> <td>Support random access</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#deque">deque</a></td> <td>Dual-end queue</td> <td>End-to-end insertion, end-to-end deletion O(1)</td> <td>Unordered</td> <td>Repeatable</td> <td>One central control + Multiple buffers, support rapid addition and deletion at the beginning and end, support random access</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#forward_list">forward_list</a></td> <td>One-way linked list</td> <td>Insert and delete O(1)</td> <td>Unordered</td> <td>Repeatable</td> <td>Random access is not supported</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#list">list</a></td> <td>Doubly linked list</td> <td>Insert / delete O(1)</td> <td>Unordered</td> <td>Repeatable</td> <td>Does not support random access</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#stack">stack</a></td> <td>deque / list</td> <td>top insert, top delete O(1)</td> <td>unordered</td> <td>repeatable</td> <td>deque or list closed head The end is open. The reason why the vector is not used should be that the capacity is limited, and the expansion takes time.</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#queue">queue</a></td> <td>deque / list</td> <td>tail insertion, head deletion O(1)</td> <td>unordered</td> <td>repeatable</td> <td>deque or list closure The head end is open. The reason why the vector is not used should be that the capacity is limited, and the expansion takes time.</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#priority_queue">priority_queue</a></td> <td>vector + max-heap</td> <td>Insert, delete O(log<sub>2</sub>n)</td> <td>Ordered</td> <td>Repeatable</td> <td>vector container + heap processing rules</td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#set">set</a></td> <td>Red and Black Tree</td> <td>Insert, delete, find O(log<sub>2</sub>n)</td> <td>Ordered</td> <td>Not repeatable</td> <td></td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#multiset">multiset</a></td> <td>Red and Black Tree</td> <td>Insert, delete, find O(log<sub>2</sub>n)</td> <td>Ordered</td> <td>Repeatable</td> <td></td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#map">map</a></td> <td>Red and Black Tree</td> <td>Insert, delete, find O(log<sub>2</sub>n)</td> <td>Ordered</td> <td>Not repeatable</td> <td></td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#multimap">multimap</a></td> <td>Red and Black Tree</td> <td>Insert, delete, find O(log<sub>2</sub>n)</td> <td>Ordered</td> <td>Repeatable</td> <td></td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#unordered_set">unordered_set</a></td> <td>Hash Table</td> <td>Insert, Delete, Find O(1) Worst O(n)</td> <td>Unordered</td> <td>Not Repeatable</td> <td></td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#unordered_multiset">unordered_multiset</a></td> <td>Hash Table</td> <td>Insert, Delete, Find O(1) Worst O(n)</td> <td>Unordered</td> <td>Repeatable</td> <td></td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#unordered_map">unordered_map</a></td> <td>Hash Table</td> <td>Insert, Delete, Find O(1) Worst O(n)</td> <td>Unordered</td> <td>Not Repeatable</td> <td></td> </tr> <tr> <td><a href="https://github.com/huihut/interview/tree/master/STL#unordered_multimap">unordered_multimap</a></td> <td>Hash Table</td> <td>Insert, Delete, Find O(1) Worst O(n)</td> <td>Unordered</td> <td>Repeatable</td> <td></td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">STL Algorithm</h3><a id="user-content-stl-algorithm" class="anchor" aria-label="Permalink: STL Algorithm" href="#stl-algorithm"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Algorithm</th> <th>Low-level algorithm</th> <th>Time complexity</th> <th>Can not be repeated</th> </tr> </thead> <tbody> <tr> <td><a href="http://www.cplusplus.com/reference/algorithm/find/" rel="nofollow">find</a></td> <td>Sequence search</td> <td>O(n)</td> <td>Repeatable</td> </tr> <tr> <td><a href="https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/include/bits/stl_algo.h#L4808">sort</a></td> <td><a href="https://en.wikipedia.org/wiki/Introsort" rel="nofollow">Introspection sorting</a></td> <td>O(n*log<sub>2</sub>n)</td> <td>Repeatable</td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto"><a id="user-content-data-structure"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">〽️ Data Structure</h2><a id="user-content-️-data-structure" class="anchor" aria-label="Permalink: 〽️ Data Structure" href="#️-data-structure"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Sequence structure</h3><a id="user-content-sequence-structure" class="anchor" aria-label="Permalink: Sequence structure" href="#sequence-structure"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Sequential stack(Sequence Stack)</h4><a id="user-content-sequential-stacksequence-stack" class="anchor" aria-label="Permalink: Sequential stack(Sequence Stack)" href="#sequential-stacksequence-stack"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DataStructure/SqStack.cpp">SqStack.cpp</a></p> <p dir="auto">Sequential stack data structures and pictures</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="typedef struct { ElemType *elem; int top; int size; int increment; } SqStack;"><pre><span class="pl-k">typedef</span> <span class="pl-k">struct</span> { ElemType *elem; <span class="pl-k">int</span> top; <span class="pl-k">int</span> size; <span class="pl-k">int</span> increment; } SqStack;</pre></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/SqStack.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/SqStack.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">queue(Sequence Queue)</h4><a id="user-content-queuesequence-queue" class="anchor" aria-label="Permalink: queue(Sequence Queue)" href="#queuesequence-queue"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Queue data structure</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="typedef struct { ElemType * elem; int front; int rear; int maxSize; }SqQueue;"><pre><span class="pl-k">typedef</span> <span class="pl-k">struct</span> { ElemType * elem; <span class="pl-k">int</span> front; <span class="pl-k">int</span> rear; <span class="pl-k">int</span> maxSize; }SqQueue;</pre></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Acyclic queue</h5><a id="user-content-acyclic-queue" class="anchor" aria-label="Permalink: Acyclic queue" href="#acyclic-queue"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Acyclic queue picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/SqQueue.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/SqQueue.png" alt="" style="max-width: 100%;"></a></p> <p dir="auto"><code>SqQueue.rear++</code></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Circular queue</h5><a id="user-content-circular-queue" class="anchor" aria-label="Permalink: Circular queue" href="#circular-queue"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Circular queue picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/SqLoopStack.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/SqLoopStack.png" alt="" style="max-width: 100%;"></a></p> <p dir="auto"><code>SqQueue.rear = (SqQueue.rear + 1) % SqQueue.maxSize</code></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Sequence table(Sequence List)</h4><a id="user-content-sequence-tablesequence-list" class="anchor" aria-label="Permalink: Sequence table(Sequence List)" href="#sequence-tablesequence-list"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DataStructure/SqList.cpp">SqList.cpp</a></p> <p dir="auto">Sequence table data structure and pictures</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="typedef struct { ElemType *elem; int length; int size; int increment; } SqList;"><pre><span class="pl-k">typedef</span> <span class="pl-k">struct</span> { ElemType *elem; <span class="pl-k">int</span> length; <span class="pl-k">int</span> size; <span class="pl-k">int</span> increment; } SqList;</pre></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/SqList.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/SqList.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Chain structure</h3><a id="user-content-chain-structure" class="anchor" aria-label="Permalink: Chain structure" href="#chain-structure"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DataStructure/LinkList.cpp">LinkList.cpp</a></p> <p dir="auto"><a href="/huihut/interview/blob/master/DataStructure/LinkList_with_head.cpp">LinkList_with_head.cpp</a></p> <p dir="auto">Chained data structure</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="typedef struct LNode { ElemType data; struct LNode *next; } LNode, *LinkList; "><pre><span class="pl-k">typedef</span> <span class="pl-k">struct</span> <span class="pl-en">LNode</span> { ElemType data; <span class="pl-k">struct</span> <span class="pl-en">LNode</span> *next; } LNode, *LinkList; </pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Chain queue(Link Queue)</h4><a id="user-content-chain-queuelink-queue" class="anchor" aria-label="Permalink: Chain queue(Link Queue)" href="#chain-queuelink-queue"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Chain queue picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/LinkQueue.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/LinkQueue.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Chained representation of a linear list</h4><a id="user-content-chained-representation-of-a-linear-list" class="anchor" aria-label="Permalink: Chained representation of a linear list" href="#chained-representation-of-a-linear-list"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Singly-Linked list(Link List)</h5><a id="user-content-singly-linked-listlink-list" class="anchor" aria-label="Permalink: Singly-Linked list(Link List)" href="#singly-linked-listlink-list"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Singly-linked list picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/LinkList.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/LinkList.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Doubly linked list(Du-Link-List)</h5><a id="user-content-doubly-linked-listdu-link-list" class="anchor" aria-label="Permalink: Doubly linked list(Du-Link-List)" href="#doubly-linked-listdu-link-list"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Doubly-linked list picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/DuLinkList.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/DuLinkList.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Circular linked list(Cir-Link-List)</h5><a id="user-content-circular-linked-listcir-link-list" class="anchor" aria-label="Permalink: Circular linked list(Cir-Link-List)" href="#circular-linked-listcir-link-list"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Circular-linked list picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/CirLinkList.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/CirLinkList.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Hash table</h3><a id="user-content-hash-table" class="anchor" aria-label="Permalink: Hash table" href="#hash-table"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DataStructure/HashTable.cpp">HashTable.cpp</a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Concept</h4><a id="user-content-concept" class="anchor" aria-label="Permalink: Concept" href="#concept"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Hash function:<code>H(key): K -> D , key ∈ K</code></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Construction method</h4><a id="user-content-construction-method" class="anchor" aria-label="Permalink: Construction method" href="#construction-method"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Direct Addressing</li> <li>Divided remainder method</li> <li>Digital analysis method</li> <li>Folding method</li> <li>The square method</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Collision resolution method</h4><a id="user-content-collision-resolution-method" class="anchor" aria-label="Permalink: Collision resolution method" href="#collision-resolution-method"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Chain address method: single linked list linked with the same key</li> <li>Open Addressing <ul dir="auto"> <li>Linear detection method: same key-> put to the next position of key,<code>Hi = (H(key) + i) % m</code></li> <li>Secondary detection method: same key-> put to <code>Di = 1^2, -1^2, ..., ±(k)^2,(k<=m/2)</code></li> <li>Random detection:<code>H = (H(key) + Pseudo-random number) % m</code></li> </ul> </li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Hash table data structure for linear probing</h4><a id="user-content-hash-table-data-structure-for-linear-probing" class="anchor" aria-label="Permalink: Hash table data structure for linear probing" href="#hash-table-data-structure-for-linear-probing"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Hash table data structure and pictures for linear detection</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="typedef char KeyType; typedef struct { KeyType key; }RcdType; typedef struct { RcdType *rcd; int size; int count; bool *tag; }HashTable;"><pre><span class="pl-k">typedef</span> <span class="pl-k">char</span> KeyType; <span class="pl-k">typedef</span> <span class="pl-k">struct</span> { KeyType key; }RcdType; <span class="pl-k">typedef</span> <span class="pl-k">struct</span> { RcdType *rcd; <span class="pl-k">int</span> size; <span class="pl-k">int</span> count; <span class="pl-k">bool</span> *tag; }HashTable;</pre></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/HashTable.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/HashTable.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Recursion</h3><a id="user-content-recursion" class="anchor" aria-label="Permalink: Recursion" href="#recursion"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Concept</h4><a id="user-content-concept-1" class="anchor" aria-label="Permalink: Concept" href="#concept-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Function calls itself directly or indirectly</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Recursion and Divide</h4><a id="user-content-recursion-and-divide" class="anchor" aria-label="Permalink: Recursion and Divide" href="#recursion-and-divide"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Divide and Conquer <ul dir="auto"> <li>Breakdown of the problem</li> <li>Problem size decomposition</li> </ul> </li> <li>Half search (recursive)</li> <li>Merge sort (recursive)</li> <li>Quick sort (recursive)</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Recursion and Iteration</h4><a id="user-content-recursion-and-iteration" class="anchor" aria-label="Permalink: Recursion and Iteration" href="#recursion-and-iteration"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Iteration: use the old value of the variable repeatedly to push out the new value</li> <li>Search in half (iterative)</li> <li>Merge sort (iterative)</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Generalized table</h4><a id="user-content-generalized-table" class="anchor" aria-label="Permalink: Generalized table" href="#generalized-table"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Head and tail linked list storage representation</h5><a id="user-content-head-and-tail-linked-list-storage-representation" class="anchor" aria-label="Permalink: Head and tail linked list storage representation" href="#head-and-tail-linked-list-storage-representation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Head and tail linked list storage representations and pictures for generalized tables</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Head-to-tail linked list storage representation of generalized list typedef enum {ATOM, LIST} ElemTag; // ATOM == 0: atom, LIST == 1: child table typedef struct GLNode { ElemTag tag; // public part, used to distinguish atomic nodes from table nodes union { // joint part of atomic node and table node AtomType atom; // atom is the range of atom nodes, AtomType is defined by the user struct { struct GLNode *hp, *tp; } ptr; /// ptr is the pointer field of the table node, prt.hp and ptr.tp point to the table header and table tail respectively } a; } *GList, GLNode;"><pre><span class="pl-c"><span class="pl-c">//</span> Head-to-tail linked list storage representation of generalized list</span> <span class="pl-k">typedef</span> <span class="pl-k">enum</span> {ATOM, LIST} ElemTag; <span class="pl-c"><span class="pl-c">//</span> ATOM == 0: atom, LIST == 1: child table</span> <span class="pl-k">typedef</span> <span class="pl-k">struct</span> <span class="pl-en">GLNode</span> { ElemTag tag; <span class="pl-c"><span class="pl-c">//</span> public part, used to distinguish atomic nodes from table nodes</span> <span class="pl-k">union</span> { <span class="pl-c"><span class="pl-c">//</span> joint part of atomic node and table node</span> AtomType atom; <span class="pl-c"><span class="pl-c">//</span> atom is the range of atom nodes, AtomType is defined by the user</span> <span class="pl-k">struct</span> { <span class="pl-k">struct</span> <span class="pl-en">GLNode</span> *hp, *tp; } ptr; <span class="pl-c"><span class="pl-c">//</span>/ ptr is the pointer field of the table node, prt.hp and ptr.tp point to the table header and table tail respectively</span> } a; } *GList, GLNode;</pre></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList1.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList1.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Extended linear linked list storage representation</h5><a id="user-content-extended-linear-linked-list-storage-representation" class="anchor" aria-label="Permalink: Extended linear linked list storage representation" href="#extended-linear-linked-list-storage-representation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Extended linear linked list storage representations and pictures</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Extended linear linked list storage representation of generalized tables typedef enum {ATOM, LIST} ElemTag; // ATOM == 0: atom, LIST == 1: child table typedef struct GLNode1 { ElemTag tag; // public part, used to distinguish atomic nodes from table nodes union { // joint part of atomic node and table node AtomType atom; // range of atom nodes struct GLNode1 *hp; // table pointer pointer } a; struct GLNode1 *tp; // Equivalent to next of a linear linked list, pointing to the next } *GList1, GLNode1;"><pre><span class="pl-c"><span class="pl-c">//</span> Extended linear linked list storage representation of generalized tables</span> <span class="pl-k">typedef</span> <span class="pl-k">enum</span> {ATOM, LIST} ElemTag; <span class="pl-c"><span class="pl-c">//</span> ATOM == 0: atom, LIST == 1: child table</span> <span class="pl-k">typedef</span> <span class="pl-k">struct</span> <span class="pl-en">GLNode1</span> { ElemTag tag; <span class="pl-c"><span class="pl-c">//</span> public part, used to distinguish atomic nodes from table nodes</span> <span class="pl-k">union</span> { <span class="pl-c"><span class="pl-c">//</span> joint part of atomic node and table node</span> AtomType atom; <span class="pl-c"><span class="pl-c">//</span> range of atom nodes</span> <span class="pl-k">struct</span> <span class="pl-en">GLNode1</span> *hp; <span class="pl-c"><span class="pl-c">//</span> table pointer pointer</span> } a; <span class="pl-k">struct</span> <span class="pl-en">GLNode1</span> *tp; <span class="pl-c"><span class="pl-c">//</span> Equivalent to next of a linear linked list, pointing to the next </span> } *GList1, GLNode1;</pre></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList2.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/GeneralizedList2.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Binary tree</h3><a id="user-content-binary-tree" class="anchor" aria-label="Permalink: Binary tree" href="#binary-tree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DataStructure/BinaryTree.cpp">BinaryTree.cpp</a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">properties</h4><a id="user-content-properties" class="anchor" aria-label="Permalink: properties" href="#properties"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Up to 2<sup>(i-1)</sup> nodes at the i-th level of a non-empty binary tree (i> = 1)</li> <li>Binary tree with depth k up to 2<sup>k</sup>-1 node (k >= 1)</li> <li>The number of nodes with degree 0 is n<sub>0</sub>, and the number of nodes with degree 2 is n<sub>2</sub>, then n<sub>0</sub> = n<sub>2</sub> + 1</li> <li>Full binary tree depth with n nodes k = ⌊ log <sub> 2 </ sub> (n) ⌋ + 1</sub></li> <li>For the node numbered i (1 <= i <= n) in a complete binary tree with n nodes <ol dir="auto"> <li>If i = 1, it is the root, otherwise the parents are ⌊ i / 2 ⌋</li> <li>If 2i > n, node i has no left child, otherwise the child number is 2i</li> <li>If 2i + 1> n, the i node has no right child, otherwise the child number is 2i + 1</li> </ol> </li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Storage structure</h4><a id="user-content-storage-structure" class="anchor" aria-label="Permalink: Storage structure" href="#storage-structure"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Binary tree data structure</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="typedef struct BiTNode { TElemType data; struct BiTNode *lchild, *rchild; }BiTNode, *BiTree;"><pre><span class="pl-k">typedef</span> <span class="pl-k">struct</span> <span class="pl-en">BiTNode</span> { TElemType data; <span class="pl-k">struct</span> <span class="pl-en">BiTNode</span> *lchild, *rchild; }BiTNode, *BiTree;</pre></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Sequential storage</h5><a id="user-content-sequential-storage" class="anchor" aria-label="Permalink: Sequential storage" href="#sequential-storage"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Binary tree sequential storage pictures</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/SqBinaryTree.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/SqBinaryTree.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Chained storage</h5><a id="user-content-chained-storage" class="anchor" aria-label="Permalink: Chained storage" href="#chained-storage"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Binary tree chain store pictures</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/LinkBinaryTree.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/LinkBinaryTree.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Traversal</h4><a id="user-content-traversal" class="anchor" aria-label="Permalink: Traversal" href="#traversal"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Sequence traversal</li> <li>In-order traversal</li> <li>Subsequent traversals</li> <li>Hierarchical traversal</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Categories</h4><a id="user-content-categories" class="anchor" aria-label="Permalink: Categories" href="#categories"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Full Binary Tree</li> <li>Complete binary tree (heap) <ul dir="auto"> <li>Big top heap: root> = left && root> = right</li> <li>Small top heap: root <= left && root <= right</li> </ul> </li> <li>Binary search tree (binary sort tree): left <root <right</li> <li>Balanced binary tree (AVL tree): | Left subtree tree height-Right subtree tree height | <= 1</li> <li>Least Imbalanced Tree: Balanced Binary Tree Inserting New Nodes Causes Imbalanced Subtree: Adjustment: <ul dir="auto"> <li>LL type: left-handed child of the root</li> <li>RR type: right child of the root</li> <li>LR type: Left-handed child of the root, left-handed</li> <li>RL type: Left child of right child, turn right first, then left</li> </ul> </li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Other trees and forests</h3><a id="user-content-other-trees-and-forests" class="anchor" aria-label="Permalink: Other trees and forests" href="#other-trees-and-forests"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">The storage structure of the tree</h4><a id="user-content-the-storage-structure-of-the-tree" class="anchor" aria-label="Permalink: The storage structure of the tree" href="#the-storage-structure-of-the-tree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Parental notation</li> <li>Parental notation</li> <li>Child brother notation</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">And check</h4><a id="user-content-and-check" class="anchor" aria-label="Permalink: And check" href="#and-check"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">A set of disjoint subsets S = {S1, S2, ..., Sn}</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Balanced Binary Tree (AVL Tree)</h4><a id="user-content-balanced-binary-tree-avl-tree" class="anchor" aria-label="Permalink: Balanced Binary Tree (AVL Tree)" href="#balanced-binary-tree-avl-tree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">nature</h5><a id="user-content-nature" class="anchor" aria-label="Permalink: nature" href="#nature"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>| Left Subtree Tree Height-Right Subtree Tree Height | <= 1</li> <li>A balanced binary tree must be a binary search tree, otherwise it is not necessarily</li> <li>The formula of the nodes of the minimum binary balanced tree: <code>F(n) = F(n-1) + F(n-2) + 1</code> (1 is the root node, F (n-1) is the left subtree Number of nodes, F (n-2) is the number of nodes in the right subtree)</li> </ul> <p dir="auto">Balanced binary tree pictures</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/Self-balancingBinarySearchTree.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/Self-balancingBinarySearchTree.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Minimal Imbalance Tree</h5><a id="user-content-minimal-imbalance-tree" class="anchor" aria-label="Permalink: Minimal Imbalance Tree" href="#minimal-imbalance-tree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Balanced binary tree inserting new nodes causes unbalanced subtrees</p> <p dir="auto">Adjustment:</p> <ul dir="auto"> <li>LL type: left child of the root</li> <li>RR type: right child of the root</li> <li>LR type: Left-handed child of the root, left-handed, then right-handed</li> <li>RL type: Left child of right child, right-handed first, then left-handed</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Red black tree</h4><a id="user-content-red-black-tree" class="anchor" aria-label="Permalink: Red black tree" href="#red-black-tree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DataStructure/RedBlackTree.cpp">RedBlackTree.cpp</a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">What are the characteristics of red-black trees?</h5><a id="user-content-what-are-the-characteristics-of-red-black-trees" class="anchor" aria-label="Permalink: What are the characteristics of red-black trees?" href="#what-are-the-characteristics-of-red-black-trees"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>The nodes are red or black.</li> <li>The root is black.</li> <li>All leaves are black (the leaves are NIL nodes).</li> <li>Each red node must have two black child nodes. (There cannot be two consecutive red nodes on all paths from each leaf to the root.) (The parent node of the new node must be the same)</li> <li>All simple paths from any node to each of its leaves contain the same number of black nodes. (New nodes must be red)</li> </ol> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Adjustment</h5><a id="user-content-adjustment" class="anchor" aria-label="Permalink: Adjustment" href="#adjustment"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Discoloration Left Right turn</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Application</h5><a id="user-content-application" class="anchor" aria-label="Permalink: Application" href="#application"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Associative arrays: such as map, set in STL</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">What is the difference between red and black trees, B trees, and B + trees?</h5><a id="user-content-what-is-the-difference-between-red-and-black-trees-b-trees-and-b--trees" class="anchor" aria-label="Permalink: What is the difference between red and black trees, B trees, and B + trees?" href="#what-is-the-difference-between-red-and-black-trees-b-trees-and-b--trees"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>The depth of the red-black tree is larger, while the depth of the B-tree and B + -tree is relatively smaller</li> <li>B + trees store data in leaf nodes, and connect them together in the form of linked lists.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">B-tree, B + -tree</h4><a id="user-content-b-tree-b---tree" class="anchor" aria-label="Permalink: B-tree, B + -tree" href="#b-tree-b---tree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">B-tree, B+-tree pictures</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/37684966582d6ca9ab5f976e3a2a1e4b4f7e4a03ae761eaae6771f65be5f0f72/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f6c365579462e706e67"><img src="https://camo.githubusercontent.com/37684966582d6ca9ab5f976e3a2a1e4b4f7e4a03ae761eaae6771f65be5f0f72/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f6c365579462e706e67" alt="B tree (B-tree), B+ tree (B+-tree)" data-canonical-src="https://i.stack.imgur.com/l6UyF.png" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Features</h5><a id="user-content-features-1" class="anchor" aria-label="Permalink: Features" href="#features-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Generalized binary search tree</li> <li>"Puffy", internal (non-leaf) nodes can have a variable number of child nodes (the number range is predefined)</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Application</h5><a id="user-content-application-1" class="anchor" aria-label="Permalink: Application" href="#application-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Most file systems and database systems use B-trees and B + trees as index structures</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">the difference</h5><a id="user-content-the-difference-1" class="anchor" aria-label="Permalink: the difference" href="#the-difference-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Only leaf nodes in the B + tree will have pointers to records (ROWID), while all nodes in the B-tree will have, and the index items appearing in the internal nodes will no longer appear in the leaf nodes.</li> <li>All leaf nodes in the B + tree are connected by pointers, while the B tree does not.</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Advantages of B-tree</h5><a id="user-content-advantages-of-b-tree" class="anchor" aria-label="Permalink: Advantages of B-tree" href="#advantages-of-b-tree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The data at the internal nodes can be obtained directly without having to locate according to the leaf nodes.</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Advantages of B + trees</h5><a id="user-content-advantages-of-b--trees" class="anchor" aria-label="Permalink: Advantages of B + trees" href="#advantages-of-b--trees"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Non-leaf nodes do not carry ROWID. In this way, more index entries can be accommodated in a block. One is to reduce the height of the tree. The second is that an internal node can locate more leaf nodes.</li> <li>The leaf nodes are connected by pointers. The range scan will be very simple. For the B-tree, the leaf nodes and internal nodes need to be moved back and forth continuously.</li> </ul> <blockquote> <p dir="auto">The difference between B-tree and B + -tree comes from:<a href="https://stackoverflow.com/questions/870218/differences-between-b-trees-and-b-trees" rel="nofollow">differences-between-b-trees-and-b-trees</a>、<a href="https://www.cnblogs.com/ivictor/p/5849061.html" rel="nofollow">Difference between B-tree and B + tree</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Octree</h4><a id="user-content-octree" class="anchor" aria-label="Permalink: Octree" href="#octree"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Octree picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/24e4f4240b5cd3109c3dc74cb8327e7024cf4c55eda94417c0c9a8dafe1d2132/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f332f33352f4f6374726565322e706e672f34303070782d4f6374726565322e706e67"><img src="https://camo.githubusercontent.com/24e4f4240b5cd3109c3dc74cb8327e7024cf4c55eda94417c0c9a8dafe1d2132/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f332f33352f4f6374726565322e706e672f34303070782d4f6374726565322e706e67" alt="" data-canonical-src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Octree2.png/400px-Octree2.png" style="max-width: 100%;"></a></p> <p dir="auto">An octree is a tree-like data structure used to describe three-dimensional space (dividing space). Each node of the octree represents a volume element of a cube, and each node has eight child nodes. The volume elements represented by the eight child nodes are added together to equal the volume of the parent node. The general center point is used as the bifurcation center of the node.</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Purpose</h5><a id="user-content-purpose" class="anchor" aria-label="Permalink: Purpose" href="#purpose"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>3D computer graphics</li> <li>Nearest Search</li> </ul> <p dir="auto"><a id="user-content-algorithm"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">⚡️ Algorithm</h2><a id="user-content-️-algorithm" class="anchor" aria-label="Permalink: ⚡️ Algorithm" href="#️-algorithm"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Sort</h3><a id="user-content-sort" class="anchor" aria-label="Permalink: Sort" href="#sort"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Sorting Algorithm</th> <th>Average Time Complexity</th> <th>Worst Time Complexity</th> <th>Spatial Complexity</th> <th>Data Object Stability</th> </tr> </thead> <tbody> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/BubbleSort.h">Bubble Sort</a></td> <td>O(n<sup>2</sup>)</td> <td>O(n<sup>2</sup>)</td> <td>O(1)</td> <td>Stable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/SelectionSort.h">Selection Sort</a></td> <td>O(n<sup>2</sup>)</td> <td>O(n<sup>2</sup>)</td> <td>O(1)</td> <td>The array is unstable and the linked list is stable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/InsertSort.h">Insert Sort</a></td> <td>O(n<sup>2</sup>)</td> <td>O(n<sup>2</sup>)</td> <td>O(1)</td> <td>Stable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/QuickSort.h">Quick Sort</a></td> <td>O(n*log<sub>2</sub>n)</td> <td>O(n<sup>2</sup>)</td> <td>O(log<sub>2</sub>n)</td> <td>Unstable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/HeapSort.cpp">Heap Sort</a></td> <td>O(n*log<sub>2</sub>n)</td> <td>O(n*log<sub>2</sub>n)</td> <td>O(1)</td> <td>Unstable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/MergeSort.h">Merge Sort</a></td> <td>O(n*log<sub>2</sub>n)</td> <td>O(n*log<sub>2</sub>n)</td> <td>O(n)</td> <td>Stable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/ShellSort.h">Shell Sort</a></td> <td>O(n*log<sup>2</sup>n)</td> <td>O(n<sup>2</sup>)</td> <td>O(1)</td> <td>Unstable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/CountSort.cpp">Count Sort</a></td> <td>O(n+m)</td> <td>O(n+m)</td> <td>O(n+m)</td> <td>Stable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/BucketSort.cpp">Bucket Sort</a></td> <td>O(n)</td> <td>O(n)</td> <td>O(m)</td> <td>Stable</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/RadixSort.h">Radix Sort</a></td> <td>O(k*n)</td> <td>O(n<sup>2</sup>)</td> <td></td> <td>Stable</td> </tr> </tbody> </table></markdown-accessiblity-table> <blockquote> <ul dir="auto"> <li>Are arranged in ascending order</li> <li>k: represents the number of "digits" in the value</li> <li>n: represents the size of the data</li> <li>m: represents the maximum value minus the minimum value of the data</li> <li>From: <a href="https://en.wikipedia.org/wiki/Sorting_algorithm" rel="nofollow">wikipedia. Sorting Algorithm</a></li> </ul> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Find</h3><a id="user-content-find" class="anchor" aria-label="Permalink: Find" href="#find"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Find Algorithm</th> <th>Average Time Complexity</th> <th>Spatial Complexity</th> <th>Find Conditions</th> </tr> </thead> <tbody> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/SequentialSearch.h">SequentialSearch</a></td> <td>O(n)</td> <td>O(1)</td> <td>sorted or unsorted</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/BinarySearch.h">Binary search (half search)</a></td> <td>O(log<sub>2</sub>n)</td> <td>O(1)</td> <td>sorted</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/InsertionSearch.h">Insertion Search</a></td> <td>O(log<sub>2</sub>(log<sub>2</sub>n))</td> <td>O(1)</td> <td>sorted</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/FibonacciSearch.cpp">Fibonacci Search</a></td> <td>O(log<sub>2</sub>n)</td> <td>O(1)</td> <td>soted</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/DataStructure/HashTable.cpp">Hash Table</a></td> <td>O(1)</td> <td>O(n)</td> <td>sorted or unsorted</td> </tr> <tr> <td><a href="/huihut/interview/blob/master/Algorithm/BSTSearch.h">Binary Search Tree (BST Search)</a></td> <td>O(log<sub>2</sub>n)</td> <td></td> <td></td> </tr> <tr> <td><a href="/huihut/interview/blob/master/DataStructure/RedBlackTree.cpp">Red Black Tree</a></td> <td>O(log<sub>2</sub>n)</td> <td></td> <td></td> </tr> <tr> <td>2-3 Tree</td> <td>O(log<sub>2</sub>n - log<sub>3</sub>n)</td> <td></td> <td></td> </tr> <tr> <td>B Tree/B+ Tree</td> <td>O(log<sub>2</sub>n)</td> <td></td> <td></td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Graph search algorithm</h3><a id="user-content-graph-search-algorithm" class="anchor" aria-label="Permalink: Graph search algorithm" href="#graph-search-algorithm"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Graph Search Algorithm</th> <th>Data Structure</th> <th>Traversal Time Complexity</th> <th>Spatial Complexity</th> </tr> </thead> <tbody> <tr> <td><a href="https://zh.wikipedia.org/wiki/%E5%B9%BF%E5%BA%A6%E4%BC%98%E5%85%88%E6%90%9C%E7%B4%A2" rel="nofollow">BFS - Breadth First Search</a></td> <td>adjacency matrix <br> adjacency list</td> <td>O(|v|<sup>2</sup>)<br>O(|v|+|E|)</td> <td>O(|v|<sup>2</sup>)<br>O(|v|+|E|)</td> </tr> <tr> <td><a href="https://zh.wikipedia.org/wiki/%E6%B7%B1%E5%BA%A6%E4%BC%98%E5%85%88%E6%90%9C%E7%B4%A2" rel="nofollow">DFS - Depth-First Search</a></td> <td>adjacency matrix <br> adjacent linked list</td> <td>O(|v|<sup>2</sup>)<br>O(|v|+|E|)</td> <td>O(|v|<sup>2</sup>)<br>O(|v|+|E|)</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Other algorithms</h3><a id="user-content-other-algorithms" class="anchor" aria-label="Permalink: Other algorithms" href="#other-algorithms"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Algorithms</th> <th>Ideas</th> <th>Applications</th> </tr> </thead> <tbody> <tr> <td><a href="https://en.wikipedia.org/wiki/%E5%88%86%E6%B2%BB%E6%B3%95" rel="nofollow">Divide and Conquer</a></td> <td>Divide a complex problem into two or more The same or similar sub-problems, until the last sub-problem can be simply and directly solved, the solution of the original problem is the combination of the solutions of the sub-problems</td> <td><a href="https://github.com/huihut/interview/tree/master/Problems/RoundRobinProblem">loop schedule problem</a>, sorting algorithms (quick sort, merge sort)</td> </tr> <tr> <td><a href="https://en.wikipedia.org/wiki/%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92" rel="nofollow">Dynamic Programming</a></td> <td>By decomposing the original problem into relative Simple sub-question way to solve complex problems, suitable for problems with overlapping sub-problems and optimal sub-structure properties</td> <td>[knapsack problem] KnapsackProblem), Fibonacci sequence</td> </tr> <tr> <td><a href="https://en.wikipedia.org/wiki/%E8%B4%AA%E5%BF%83%E6%B3%95" rel="nofollow">Greedy method</a></td> <td>A kind of choice is taken in the current state in each step The best or optimal (that is, the most advantageous) choice, so that the result is the best or optimal algorithm</td> <td>Travel Salesman Problem (Shortest Path Problem), Minimum Spanning Tree, Huffman Coding</td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto"><a id="user-content-problems"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">❓ Problems</h2><a id="user-content--problems" class="anchor" aria-label="Permalink: ❓ Problems" href="#-problems"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Single Problem</h3><a id="user-content-single-problem" class="anchor" aria-label="Permalink: Single Problem" href="#single-problem"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="/huihut/interview/blob/master/Problems/ChessboardCoverageProblem">Chessboard Coverage Problem (Checkerboard coverage problem)</a></li> <li><a href="/huihut/interview/blob/master/Problems/KnapsackProblem">Knapsack Problem</a></li> <li><a href="/huihut/interview/blob/master/Problems/NeumannNeighborProblem">Neumann Neighbor Problem</a></li> <li><a href="/huihut/interview/blob/master/Problems/RoundRobinProblem">Round Robin Problem</a></li> <li><a href="/huihut/interview/blob/master/Problems/TubingProblem">Tubing Problem</a></li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Leetcode Problems</h3><a id="user-content-leetcode-problems" class="anchor" aria-label="Permalink: Leetcode Problems" href="#leetcode-problems"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="https://github.com/haoel/leetcode">Github . haoel/leetcode</a></li> <li><a href="https://github.com/pezy/LeetCode">Github . pezy/LeetCode</a></li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Sword Finger Offer</h3><a id="user-content-sword-finger-offer" class="anchor" aria-label="Permalink: Sword Finger Offer" href="#sword-finger-offer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="https://github.com/zhedahht/CodingInterviewChinese2">Github . zhedahht/CodingInterviewChinese2</a></li> <li><a href="https://github.com/gatieme/CodingInterviews">Github . gatieme/CodingInterviews</a></li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Cracking the Coding Interview (Programmer Interview Gold)</h3><a id="user-content-cracking-the-coding-interview-programmer-interview-gold" class="anchor" aria-label="Permalink: Cracking the Coding Interview (Programmer Interview Gold)" href="#cracking-the-coding-interview-programmer-interview-gold"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="https://github.com/careercup/ctci">Github . careercup/ctci</a></li> <li><a href="https://www.nowcoder.com/ta/cracking-the-coding-interview" rel="nofollow">Niu Ke. Programmer interview golden code</a></li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Niu Ke</h3><a id="user-content-niu-ke" class="anchor" aria-label="Permalink: Niu Ke" href="#niu-ke"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="https://www.nowcoder.com/activity/oj" rel="nofollow">Niu Ke . Online programming topics</a></li> </ul> <p dir="auto"><a id="user-content-os"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">💻 Operating system</h2><a id="user-content--operating-system" class="anchor" aria-label="Permalink: 💻 Operating system" href="#-operating-system"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Processes and threads</h3><a id="user-content-processes-and-threads" class="anchor" aria-label="Permalink: Processes and threads" href="#processes-and-threads"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">For threaded systems:</p> <ul dir="auto"> <li>Processes are independent units of resource allocation</li> <li>Thread is an independent unit of resource scheduling</li> </ul> <p dir="auto">For non-threaded systems:</p> <ul dir="auto"> <li>Process is an independent unit of resource scheduling and allocation</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Communication between processes and advantages and disadvantages</h4><a id="user-content-communication-between-processes-and-advantages-and-disadvantages" class="anchor" aria-label="Permalink: Communication between processes and advantages and disadvantages" href="#communication-between-processes-and-advantages-and-disadvantages"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Pipeline (PIPE) <ul dir="auto"> <li>Famous Pipeline: A half-duplex communication method that allows communication between unrelated processes <ul dir="auto"> <li>Advantages: can achieve inter-process communication in any relationship</li> <li>Disadvantages: <ol dir="auto"> <li>Long-term storage in the system, improper use is prone to errors Limited buffer</li> </ol> </li> </ul> </li> <li>Unnamed pipe: a half-duplex communication method that can only be used between processes with parental relationships (parent-child processes) <ul dir="auto"> <li>Advantages: simple and convenient</li> <li>Disadvantages: Limited to one-way communication 2. Can only be created between its processes and their related processes 3. Limited buffer</li> </ul> </li> </ul> </li> <li>Semaphore: a counter that can be used to control access to shared resources by multiple threads <ul dir="auto"> <li>Advantages: can synchronize processes</li> <li>Disadvantage: limited semaphore</li> </ul> </li> <li>Signal (Signal): a more complex communication method used to notify the receiving process that an event has occurred</li> <li>Message Queue: a linked list of messages, stored in the kernel and identified by the message queue identifier <ul dir="auto"> <li>Advantages: can achieve communication between any process, and achieve synchronization between message sending and receiving through system call functions, no need to consider synchronization issues, convenient</li> <li>Disadvantages: Copying information requires additional CPU time, which is not suitable for situations with large amounts of information or frequent operations</li> </ul> </li> <li>Shared Memory: Maps a piece of memory that can be accessed by other processes. This shared memory is created by one process, but can be accessed by multiple processes. <ul dir="auto"> <li>Advantages: no need to copy, fast, large amount of information</li> <li>Disadvantages: <ol dir="auto"> <li>Communication is achieved by directly attaching the shared space buffer to the virtual address space of the process, so the synchronization of read and write operations between processes</li> <li>Use the memory buffer to directly exchange information. The entity of memory exists in the computer and can only be shared with many processes in a computer system, which is not convenient for network communication.</li> </ol> </li> </ul> </li> <li>Socket (Socket): can be used for process communication between different computers <ul dir="auto"> <li>Advantages: <ol dir="auto"> <li>The transmission data is byte level, the transmission data can be customized, the data volume is small and the efficiency is high</li> <li>Short data transmission time and high performance</li> <li>Suitable for real-time information exchange between client and server</li> <li>Can be encrypted, strong data security</li> </ol> </li> <li>Disadvantages: The transmitted data needs to be parsed and converted into application-level data.</li> </ul> </li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Communication between threads</h4><a id="user-content-communication-between-threads" class="anchor" aria-label="Permalink: Communication between threads" href="#communication-between-threads"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Locking mechanism: including mutex, reader-writer lock, spin lock, and condition <ul dir="auto"> <li>Mutex (mutex): Provides an exclusive way to prevent data structures from being modified concurrently.</li> <li>Reader-writer lock: Allow multiple threads to read shared data at the same time, and are mutually exclusive for write operations.</li> <li>Spin locks are similar to mutex locks in order to protect shared resources. The mutex is when the resource is occupied and the applicant goes to sleep; the spin lock circularly detects whether the holder has released the lock.</li> <li>Condition variable (condition): you can atomically block the process until a certain condition is true. Testing of conditions is performed under the protection of a mutex. Condition variables are always used with a mutex.</li> </ul> </li> <li>Semaphore mechanism <ul dir="auto"> <li>Unknown thread semaphore</li> <li>Named thread semaphore</li> </ul> </li> <li>Signal mechanism (Signal): similar to signal processing between processes</li> <li>Barrier: A barrier allows each thread to wait until all cooperating threads reach a certain point, and then continue execution from that point.</li> </ul> <p dir="auto">The purpose of communication between threads is mainly for thread synchronization, so threads have no communication mechanism for data exchange like in process communication.</p> <blockquote> <p dir="auto">The communication methods between processes and their advantages and disadvantages come from: <a href="http://blog.csdn.net/wujiafei_njgcxy/article/details/77098977" rel="nofollow">Process thread interview question summary</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Private and shared resources between processes</h4><a id="user-content-private-and-shared-resources-between-processes" class="anchor" aria-label="Permalink: Private and shared resources between processes" href="#private-and-shared-resources-between-processes"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Private: address space, heap, global variables, stack, registers</li> <li>Share: code snippet, public data, process directory, process ID</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Private and shared resources between threads</h4><a id="user-content-private-and-shared-resources-between-threads" class="anchor" aria-label="Permalink: Private and shared resources between threads" href="#private-and-shared-resources-between-threads"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Private: thread stack, register, program counter</li> <li>Shared: heap, address space, global variables, static variables</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Comparison, advantages and disadvantages of multi-process and multi-thread</h4><a id="user-content-comparison-advantages-and-disadvantages-of-multi-process-and-multi-thread" class="anchor" aria-label="Permalink: Comparison, advantages and disadvantages of multi-process and multi-thread" href="#comparison-advantages-and-disadvantages-of-multi-process-and-multi-thread"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Compared</h5><a id="user-content-compared" class="anchor" aria-label="Permalink: Compared" href="#compared"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Contrast Dimensions</th> <th>Multi-Process</th> <th>Multi-Threaded</th> <th>Summary</th> </tr> </thead> <tbody> <tr> <td>Data sharing and synchronization</td> <td>Complex data sharing requires IPC; data is separate and easy to synchronize</td> <td>Because process data is shared, data sharing is simple, but it is also because of this reason that synchronization is complicated</td> <td>Each advantage</td> </tr> <tr> <td>Memory, CPU</td> <td>Occupies more memory, complex switching, low CPU utilization</td> <td>Less memory, simple switching, high CPU utilization</td> <td>Threads dominate</td> </tr> <tr> <td>Create destroy, switch</td> <td>create destroy, switch complex, slow speed</td> <td>create destroy, switch simple, fast speed</td> <td>thread dominant</td> </tr> <tr> <td>Programming, debugging</td> <td>simple programming, simple debugging</td> <td>complex programming, complex debugging</td> <td>process dominates</td> </tr> <tr> <td>Reliability</td> <td>Processes will not affect each other</td> <td>Hanging a thread will cause the entire process to hang</td> <td>Process dominance</td> </tr> <tr> <td>Distributed</td> <td>Applicable to multi-core, multi-machine distributed; if one machine is not enough, it is relatively simple to expand to multiple machines</td> <td>adapted to multi-core distributed</td> <td>process dominant</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Pros and cons</h5><a id="user-content-pros-and-cons" class="anchor" aria-label="Permalink: Pros and cons" href="#pros-and-cons"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Pros and cons</th> <th>multi-process</th> <th>multi-threaded</th> </tr> </thead> <tbody> <tr> <td>Advantages</td> <td>Simple programming and debugging, high reliability</td> <td>Fast creation, destruction, switching, small memory and resource occupation</td> </tr> <tr> <td>Disadvantages</td> <td>Creating, destroying, slow switching, large memory and resource occupation</td> <td>Complex programming and debugging, poor reliability</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Select</h5><a id="user-content-select" class="anchor" aria-label="Permalink: Select" href="#select"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Need to frequently create and destroy priority threads</li> <li>Priority threads that require a lot of calculations</li> <li>Strongly related processing threads, weakly related processing processes</li> <li>May be extended to multi-machine distributed processes, multi-core distributed threads</li> <li>When all meet the needs, use the method you are most familiar with</li> </ul> <blockquote> <p dir="auto">The comparison, advantages and disadvantages of multi-process and multi-thread come from: <a href="https://blog.csdn.net/lishenglong666/article/details/8557215" rel="nofollow">multi-thread or multi-process selection and difference</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Linux kernel synchronization</h3><a id="user-content-linux-kernel-synchronization" class="anchor" aria-label="Permalink: Linux kernel synchronization" href="#linux-kernel-synchronization"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">the reason</h4><a id="user-content-the-reason" class="anchor" aria-label="Permalink: the reason" href="#the-reason"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">In modern operating systems, there may be multiple kernel execution streams executing at the same time, so the kernel actually needs some synchronization mechanism to synchronize the access of the execution units to shared data like multi-process and multi-thread programming. Especially on multiprocessor systems, some synchronization mechanisms are needed to synchronize the access of the execution units on different processors to shared data.</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Synchronously</h4><a id="user-content-synchronously" class="anchor" aria-label="Permalink: Synchronously" href="#synchronously"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Atomic operations</li> <li>Semaphore</li> <li>Read and write semaphore (rw_semaphore)</li> <li>Spinlock</li> <li>Big Kernel Lock (BKL, Big Kernel Lock)</li> <li>Read-write lock (rwlock)</li> <li>Brlock-Big Reader Lock</li> <li>Read-Copy Update (RCU, Read-Copy Update)</li> <li>Sequence lock (seqlock)</li> </ul> <blockquote> <p dir="auto">From: <a href="https://www.ibm.com/developerworks/cn/linux/l-synch/part1/" rel="nofollow">Linux kernel synchronization mechanism, Part 1</a>, <a href="https://www.ibm.com/developerworks/cn/linux/l-synch/part2/" rel="nofollow">Linux kernel synchronization mechanism, Part 2</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Deadlock</h3><a id="user-content-deadlock" class="anchor" aria-label="Permalink: Deadlock" href="#deadlock"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Reasons</h4><a id="user-content-reasons" class="anchor" aria-label="Permalink: Reasons" href="#reasons"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Insufficient system resources</li> <li>Improper allocation of resources</li> <li>The progress order of the process operation is not suitable</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Generate conditions</h4><a id="user-content-generate-conditions" class="anchor" aria-label="Permalink: Generate conditions" href="#generate-conditions"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Mutex</li> <li>Request and hold</li> <li>Not deprived</li> <li>Loop</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Prevention</h4><a id="user-content-prevention" class="anchor" aria-label="Permalink: Prevention" href="#prevention"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Breaking mutually exclusive conditions: transforming exclusive resources into virtual resources, most of which cannot be transformed.</li> <li>Break the non-preemption condition: when a process occupies an exclusive resource and then applies for an exclusive resource that cannot be met, it will withdraw from the original resource.</li> <li>Break possession and apply conditions: Adopt a resource pre-allocation strategy, that is, apply for all resources before the process runs, run if it meets, or wait, so that it will not be occupied and applied.</li> <li>Break the loop waiting condition: implement the orderly allocation of resources, implement classification numbers for all devices, and all processes can only apply for resources in the form of increasing numbers.</li> <li>Ordered resource allocation method</li> <li>Banker Algorithm</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">File system</h3><a id="user-content-file-system" class="anchor" aria-label="Permalink: File system" href="#file-system"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Windows: FCB table + FAT + bitmap</li> <li>Unix: inode + mixed index + group link</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Host byte order and network byte order</h3><a id="user-content-host-byte-order-and-network-byte-order" class="anchor" aria-label="Permalink: Host byte order and network byte order" href="#host-byte-order-and-network-byte-order"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Host Endianness (CPU Endianness)</h4><a id="user-content-host-endianness-cpu-endianness" class="anchor" aria-label="Permalink: Host Endianness (CPU Endianness)" href="#host-endianness-cpu-endianness"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Concept</h5><a id="user-content-concept-2" class="anchor" aria-label="Permalink: Concept" href="#concept-2"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The host byte order is also called the CPU byte order. It is not determined by the operating system, but by the CPU instruction set architecture. There are two types of host byte order:</p> <ul dir="auto"> <li>Big Endian: The high-order byte is stored in the low-order address, and the low-order byte is stored in the high-order address</li> <li>Little Endian: The high-order byte is stored in the high-order address, and the low-order byte is stored in the low-order address.</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Storage method</h5><a id="user-content-storage-method" class="anchor" aria-label="Permalink: Storage method" href="#storage-method"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The 32-bit integer <code>0x12345678</code> is stored from the address starting at<code> 0x00</code>, then:</p> <markdown-accessiblity-table><table> <thead> <tr> <th>Memory address</th> <th>0x00</th> <th>0x01</th> <th>0x02</th> <th>0x03</th> </tr> </thead> <tbody> <tr> <td>Big Endian</td> <td>12</td> <td>34</td> <td>56</td> <td>78</td> </tr> <tr> <td>Little Endian</td> <td>78</td> <td>56</td> <td>34</td> <td>12</td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">Big-endian little-endian pictures</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Big-Endian.svg.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Big-Endian.svg.png" alt="Big endian" style="max-width: 100%;"></a> <a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Little-Endian.svg.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/CPU-Little-Endian.svg.png" alt="Little endian" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Judging big-endian little-endian</h5><a id="user-content-judging-big-endian-little-endian" class="anchor" aria-label="Permalink: Judging big-endian little-endian" href="#judging-big-endian-little-endian"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Judge big-endian little-endian</p> <p dir="auto">You can determine whether your CPU byte order is big-endian or little-endian:</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include <iostream> using namespace std; int main() { int i = 0x12345678; if (*((char*)&i) == 0x12) cout << "Big endian" << endl; else cout << "Little endian" << endl; return 0; }"><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span> <span class="pl-k">using</span> <span class="pl-k">namespace</span> <span class="pl-en">std</span><span class="pl-k">;</span> <span class="pl-k">int</span> <span class="pl-en">main</span>() { <span class="pl-k">int</span> i = <span class="pl-c1">0x12345678</span>; <span class="pl-k">if</span> (*((<span class="pl-k">char</span>*)&i) == <span class="pl-c1">0x12</span>) cout << <span class="pl-s"><span class="pl-pds">"</span>Big endian<span class="pl-pds">"</span></span> << endl; <span class="pl-k">else</span> cout << <span class="pl-s"><span class="pl-pds">"</span>Little endian<span class="pl-pds">"</span></span> << endl; <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Byte order of each architecture processor</h5><a id="user-content-byte-order-of-each-architecture-processor" class="anchor" aria-label="Permalink: Byte order of each architecture processor" href="#byte-order-of-each-architecture-processor"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>x86 (Intel, AMD), MOS Technology 6502, Z80, VAX, PDP-11 and other processors are little-endian;</li> <li>Motorola 6800, Motorola 68000, PowerPC 970, System/370, SPARC (except V9) processors are big-endian;</li> <li>The endianness of ARM (default little-endian), PowerPC (except PowerPC 970), DEC Alpha, SPARC V9, MIPS, PA-RISC, and IA64 are configurable.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Network byte order</h4><a id="user-content-network-byte-order" class="anchor" aria-label="Permalink: Network byte order" href="#network-byte-order"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Network byte order is a data representation format specified in TCP/IP. It has nothing to do with the specific CPU type, operating system, etc., so that it can ensure that the data can be correctly interpreted when transmitted between different hosts.</p> <p dir="auto">The network byte order uses: Big Endian arrangement.</p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Page replacement algorithm</h3><a id="user-content-page-replacement-algorithm" class="anchor" aria-label="Permalink: Page replacement algorithm" href="#page-replacement-algorithm"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">During the address mapping process, if a page to be accessed is found not to be in memory, a page fault interrupt is generated. When a page fault occurs, if there is no free page in the operating system memory, the operating system must select a page in memory to move it out of memory in order to make room for the page that is about to be paged in. The rules used to select which pages to eliminate are called page replacement algorithms.</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Categories</h4><a id="user-content-categories-1" class="anchor" aria-label="Permalink: Categories" href="#categories-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Global replacement: replacement in the entire memory space</li> <li>Partial replacement: Replace in this process</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Algorithm</h4><a id="user-content-algorithm" class="anchor" aria-label="Permalink: Algorithm" href="#algorithm"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Global:</p> <ul dir="auto"> <li>Working set algorithm</li> <li>Page rate replacement algorithm</li> </ul> <p dir="auto">Partially:</p> <ul dir="auto"> <li>Optimal Replacement Algorithm (OPT)</li> <li>First in, first out replacement algorithm (FIFO)</li> <li>Least Recently Used (LRU) Algorithm</li> <li>Clock replacement algorithm</li> </ul> <p dir="auto"><a id="user-content-computer-network"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">☁️ Computer Network</h2><a id="user-content-️-computer-network" class="anchor" aria-label="Permalink: ☁️ Computer Network" href="#️-computer-network"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">Some of the knowledge in this section comes from Computer Networking (7th Edition)</p> </blockquote> <p dir="auto">Computer network architecture:</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C%E4%BD%93%E7%B3%BB%E7%BB%93%E6%9E%84.png" alt="Computer Network Architecture" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Roles and protocols of each layer</h3><a id="user-content-roles-and-protocols-of-each-layer" class="anchor" aria-label="Permalink: Roles and protocols of each layer" href="#roles-and-protocols-of-each-layer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Layered</th> <th>role</th> <th>protocol</th> </tr> </thead> <tbody> <tr> <td>Physical layer</td> <td>Transmission of bits through the medium, determination of mechanical and electrical specifications (bits)</td> <td>RJ45, CLOCK, IEEE802.3 (repeaters, hubs)</td> </tr> <tr> <td>Data link layer</td> <td>Assemble bits into frames and point-to-point delivery (Frame)</td> <td>PPP, FR, HDLC, VLAN, MAC (bridge, switch)</td> </tr> <tr> <td>Network layer</td> <td>Responsible for the transmission of data packets from source to sink and Internet interconnection (packets)</td> <td>IP, ICMP, ARP, RARP, OSPF, IPX, RIP, IGRP (router)</td> </tr> <tr> <td>Transport layer</td> <td>Provide end-to-end reliable message delivery and error recovery (Segment)</td> <td>TCP, UDP, SPX</td> </tr> <tr> <td>Session layer</td> <td>Establishing, managing, and terminating sessions (session protocol data unit SPDU)</td> <td>NFS, SQL, NETBIOS, RPC</td> </tr> <tr> <td>Presentation Layer</td> <td>Translate, Encrypt, and Compress Data (Representation Protocol Data Unit PPDU)</td> <td>JPEG, MPEG, ASII</td> </tr> <tr> <td>Application layer</td> <td>A means to allow access to the OSI environment (Application Protocol Data Unit APDU)</td> <td>FTP, DNS, Telnet, SMTP, HTTP, WWW, NFS</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Physical layer</h3><a id="user-content-physical-layer" class="anchor" aria-label="Permalink: Physical layer" href="#physical-layer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Unit of transmitted data: bit</li> <li>Data transmission system: source system (source point, sender)-> transmission system-> destination system (receiver, destination)</li> </ul> <p dir="auto">aisle:</p> <ul dir="auto"> <li>Unidirectional channel (simplex channel): only one direction communication, no reverse direction interaction, such as broadcasting</li> <li>Two-way alternate communication (half-duplex communication): both parties of the communication can send messages, but cannot send or receive at the same time</li> <li>Two-way simultaneous communication (full-duplex communication): both parties of the communication can send and receive information at the same time</li> </ul> <p dir="auto">Channel multiplexing technology:</p> <ul dir="auto"> <li>Frequency division multiplexing (FDM, Frequency Division Multiplexing): different users in different frequency bands, users use different bandwidth resources at the same time</li> <li>Time Division Multiplexing (TDM): different users in different time slices in the same time period, all users occupy the same bandwidth at different times</li> <li>Wavelength Division Multiplexing (WDM): Frequency division multiplexing of light</li> <li>Code Division Multiplexing (CDM): Different users use different codes and can use the same frequency band for communication at the same time</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">data link layer</h3><a id="user-content-data-link-layer" class="anchor" aria-label="Permalink: data link layer" href="#data-link-layer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Main channel:</p> <ul dir="auto"> <li>Point-to-point channel</li> <li>Broadcast channel</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Point-to-point channel</h4><a id="user-content-point-to-point-channel" class="anchor" aria-label="Permalink: Point-to-point channel" href="#point-to-point-channel"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Data unit: frame</li> </ul> <p dir="auto">Three basic questions:</p> <ul dir="auto"> <li>Encapsulation: Encapsulate IP datagrams at the network layer into frames, <code>SOH-data part-EOT</code></li> <li>Transparent transmission: No matter what characters in the data part, it can be transmitted; it can be solved by byte padding method (escaping characters before conflicting characters)</li> <li>Error detection: reduce bit error rate (BER), widely use cyclic redundancy check (CRC, Cyclic Redundancy Check)</li> </ul> <p dir="auto">Point-to-Point Protocol:</p> <ul dir="auto"> <li>Point-to-Point Protocol: The protocol used by the user computer to communicate with the ISP</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Broadcast Channel</h4><a id="user-content-broadcast-channel" class="anchor" aria-label="Permalink: Broadcast Channel" href="#broadcast-channel"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Broadcast communication:</p> <ul dir="auto"> <li>Hardware address (physical address, MAC address)</li> <li>Unicast frame (one-to-one): The MAC address of the received frame is the same as the hardware address of this station</li> <li>Broadcast frame (one pair): frame sent to all stations on the local area network</li> <li>Multicast frame (one-to-many): frame sent to some sites on the local area network</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Network layer</h3><a id="user-content-network-layer" class="anchor" aria-label="Permalink: Network layer" href="#network-layer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>IP (Internet Protocol, Internet Protocol) is a protocol designed for computer networks to communicate with each other.</li> <li>ARP (Address Resolution Protocol, Address Resolution Protocol)</li> <li>ICMP (Internet Control Message Protocol, Internet Control Message Protocol)</li> <li>IGMP (Internet Group Management Protocol, Internet Group Management Protocol)</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">IP Internet Protocol</h4><a id="user-content-ip-internet-protocol" class="anchor" aria-label="Permalink: IP Internet Protocol" href="#ip-internet-protocol"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">IP address classification:</p> <ul dir="auto"> <li><code>IP address ::= (<network number>, <host number>)</code></li> </ul> <markdown-accessiblity-table><table> <thead> <tr> <th>IP address category</th> <th>network number</th> <th>network range</th> <th>host number</th> <th>IP address range</th> </tr> </thead> <tbody> <tr> <td>Class A</td> <td>8bit, the first bit is fixed at 0</td> <td>0 —— 127</td> <td>24bit</td> <td>1.0.0.0 —— 127.255.255.255</td> </tr> <tr> <td>Class B</td> <td>16bit, the first two bits are fixed at 10</td> <td>128.0 —— 191.255</td> <td>16bit</td> <td>128.0.0.0 —— 191.255.255.255</td> </tr> <tr> <td>Class C</td> <td>24bit, the first three bits are fixed at 110</td> <td>192.0.0 —— 223.255.255</td> <td>8bit</td> <td>192.0.0.0 —— 223.255.255.255</td> </tr> <tr> <td>Class D</td> <td>The first four bits are fixed at 1110, followed by the multicast address</td> <td></td> <td></td> <td></td> </tr> <tr> <td>Class E</td> <td>The first five digits are fixed at 11110, the latter are reserved for future use</td> <td></td> <td></td> <td></td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">IP datagram format:</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/IP%E6%95%B0%E6%8D%AE%E6%8A%A5%E6%A0%BC%E5%BC%8F.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/IP%E6%95%B0%E6%8D%AE%E6%8A%A5%E6%A0%BC%E5%BC%8F.png" alt="IP 数据报格式" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">ICMP Internet Control Message Protocol</h4><a id="user-content-icmp-internet-control-message-protocol" class="anchor" aria-label="Permalink: ICMP Internet Control Message Protocol" href="#icmp-internet-control-message-protocol"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">ICMP message format:</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/ICMP%E6%8A%A5%E6%96%87%E6%A0%BC%E5%BC%8F.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/ICMP%E6%8A%A5%E6%96%87%E6%A0%BC%E5%BC%8F.png" alt="ICMP message format" style="max-width: 100%;"></a></p> <p dir="auto">application:</p> <ul dir="auto"> <li>PING (Packet InterNet Groper) to test connectivity between two hosts</li> <li>TTL (Time To Live, time to live) This field specifies the maximum number of network segments that IP packets are allowed to pass before being dropped by the router.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Interior Gateway Protocol</h4><a id="user-content-interior-gateway-protocol" class="anchor" aria-label="Permalink: Interior Gateway Protocol" href="#interior-gateway-protocol"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>RIP (Routing Information Protocol, Routing Information Protocol)</li> <li>OSPF (Open Sortest Path First)</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">External gateway protocol</h4><a id="user-content-external-gateway-protocol" class="anchor" aria-label="Permalink: External gateway protocol" href="#external-gateway-protocol"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>BGP (Border Gateway Protocol, Border Gateway Protocol)</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">IP multicast</h4><a id="user-content-ip-multicast" class="anchor" aria-label="Permalink: IP multicast" href="#ip-multicast"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>IGMP (Internet Group Management Protocol, Internet Group Management Protocol)</li> <li>Multicast routing protocol</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">VPN and NAT</h4><a id="user-content-vpn-and-nat" class="anchor" aria-label="Permalink: VPN and NAT" href="#vpn-and-nat"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>VPN (Virtual Private Network)</li> <li>NAT (Network Address Translation, Network Address Translation)</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">What does the routing table contain?</h4><a id="user-content-what-does-the-routing-table-contain" class="anchor" aria-label="Permalink: What does the routing table contain?" href="#what-does-the-routing-table-contain"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Network ID (Network ID): It is the network ID of the destination address.</li> <li>Subnet mask: used to determine the network to which the IP belongs</li> <li>Next hop address / interface: It is the address of the next stop of the data on the journey sent to the destination address. Where interface points to the next hop (that is, the next route). The route in an autonomous system (AS) should contain all subnets in the area, and the default gateway (Network id: <code>0.0.0.0</code>, Netmask:<code> 0.0.0.0</code>) points to the exit of the autonomous system.</li> </ol> <p dir="auto">Depending on the application and implementation, the routing table may contain the following additional information:</p> <ol dir="auto"> <li>Cost: It is the cost required to pass the path during data transmission.</li> <li>Quality of service for routing</li> <li>List of inbound / outbound connections to be filtered in the route</li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Transport layer</h3><a id="user-content-transport-layer" class="anchor" aria-label="Permalink: Transport layer" href="#transport-layer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">protocol:</p> <ul dir="auto"> <li>TCP (Transmission Control Protocol)</li> <li>UDP (User Datagram Protocol, User Datagram Protocol)</li> </ul> <p dir="auto">port:</p> <markdown-accessiblity-table><table> <thead> <tr> <th>Applications</th> <th>FTP</th> <th>TELNET</th> <th>SMTP</th> <th>DNS</th> <th>TFTP</th> <th>HTTP</th> <th>HTTPS</th> <th>SNMP</th> </tr> </thead> <tbody> <tr> <td>Port number</td> <td>21</td> <td>23</td> <td>25</td> <td>53</td> <td>69</td> <td>80</td> <td>443</td> <td>161</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP</h4><a id="user-content-tcp" class="anchor" aria-label="Permalink: TCP" href="#tcp"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>TCP (Transmission Control Protocol, Transmission Control Protocol) is a connection-oriented, reliable, byte stream-based transport layer communication protocol, and its transmission unit is a message segment.</li> </ul> <p dir="auto">Feature:</p> <ul dir="auto"> <li>Connection oriented</li> <li>Only point-to-point (one-to-one) communication</li> <li>Reliable interaction</li> <li>Full-duplex communication</li> <li>Byte stream oriented</li> </ul> <p dir="auto">How TCP guarantees reliable transmission:</p> <ul dir="auto"> <li>Confirmation and timeout retransmission</li> <li>Reasonable fragmentation and ordering of data</li> <li>flow control</li> <li>Congestion control</li> <li>Data validation</li> </ul> <p dir="auto">TCP message structure</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8A%A5%E6%96%87.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8A%A5%E6%96%87.png" alt="TCP Message" style="max-width: 100%;"></a></p> <p dir="auto">TCP header</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E9%A6%96%E9%83%A8.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E9%A6%96%E9%83%A8.png" alt="TCP header" style="max-width: 100%;"></a></p> <p dir="auto">TCP: Status Control Code (Code, Control Flag), which takes 6 bits and has the following meaning:</p> <ul dir="auto"> <li>URG: Urgent. When <code>URG = 1</code> , it indicates that the urgent pointer field is valid, which means that the packet is an urgent packet. It tells the system that there is urgent data in this segment and it should be transmitted as soon as possible (equivalent to high-priority data), and the Urgent Pointer field in the above figure will also be enabled.</li> <li>ACK: Acknowledge. The acknowledgment number field is valid only when <code>ACK = 1</code>, which means this packet is an acknowledgment packet. When <code>ACK = 0</code>, the confirmation number is invalid.</li> <li>PSH: (Push function) If it is 1, the representative requires the other party to immediately transmit other corresponding packets in the buffer, without waiting for the buffer to be full before sending.</li> <li>RST: Reset bit (Reset). When <code>RST = 1</code>, it indicates that a serious error occurred in the TCP connection (such as due to a host crash or other reasons). You must release the connection and then re-establish the transport connection.</li> <li>SYN: Synchronous. When SYN is set to 1, it indicates that this is a connection request or connection acceptance message. Usually, the packet with the SYN flag indicates that "active" wants to connect to the other party.</li> <li>FIN: Final bit, used to release a connection. When <code>FIN = 1</code>, it means that the data of the sending end of this segment has been sent, and it is required to release the transport connection.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">UDP</h4><a id="user-content-udp" class="anchor" aria-label="Permalink: UDP" href="#udp"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>UDP (User Datagram Protocol, User Datagram Protocol) is a connectionless transport layer protocol in the OSI (Open System Interconnection) reference model, which provides a simple and unreliable information transfer service oriented to transactions, and its transmission unit Is a user datagram.</li> </ul> <p dir="auto">feature:</p> <ul dir="auto"> <li>no connection</li> <li>Best efforts to deliver</li> <li>Message-oriented</li> <li>No congestion control</li> <li>Supports one-to-one, one-to-many, many-to-one, and many-to-many interactive communication</li> <li>Small overhead</li> </ul> <p dir="auto">UDP message structure</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E6%8A%A5%E6%96%87.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E6%8A%A5%E6%96%87.png" alt="UDP 报文" style="max-width: 100%;"></a></p> <p dir="auto">UDP 首部</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E9%A6%96%E9%83%A8.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/UDP%E9%A6%96%E9%83%A8.png" alt="UDP 首部" style="max-width: 100%;"></a></p> <blockquote> <p dir="auto">TCP/UDP Pictures from <a href="https://github.com/JerryC8080/understand-tcp-udp">https://github.com/JerryC8080/understand-tcp-udp</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Difference between TCP and UDP</h4><a id="user-content-difference-between-tcp-and-udp" class="anchor" aria-label="Permalink: Difference between TCP and UDP" href="#difference-between-tcp-and-udp"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>TCP connection-oriented, UDP is connectionless;</li> <li>TCP provides reliable service, that is, the data transmitted through the TCP connection is error-free, not lost, not duplicated, and arrives in order; UDP does its best to deliver, that is, it does not guarantee reliable delivery</li> <li>TCP logical communication channel is a full-duplex reliable channel; UDP is an unreliable channel</li> <li>Each TCP connection can only be point-to-point; UDP supports one-to-one, one-to-many, many-to-one and many-to-many interactive communication</li> <li>TCP is oriented to byte streams (probably sticky packets may occur). In fact, TCP treats data as a series of unstructured byte streams; UDP is message-oriented (no sticky packets will occur)</li> <li>UDP has no congestion control, so congestion on the network will not reduce the sending rate of the source host (useful for real-time applications, such as IP phones, real-time video conferencing, etc.)</li> <li>TCP header overhead is 20 bytes; UDP header overhead is small, only 8 bytes</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP Sticky Packet</h4><a id="user-content-tcp-sticky-packet" class="anchor" aria-label="Permalink: TCP Sticky Packet" href="#tcp-sticky-packet"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">the reason</h5><a id="user-content-the-reason-1" class="anchor" aria-label="Permalink: the reason" href="#the-reason-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">TCP is a byte stream-based transmission service (UDP is message-based). "Stream" means that the data transmitted by TCP has no boundaries. So there may be situations where two data packets stick together.</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Solve</h5><a id="user-content-solve" class="anchor" aria-label="Permalink: Solve" href="#solve"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Send fixed-length packets. If the size of each message is the same, the receiving peer only needs to accumulate the received data until the data is equal to a fixed-length value and treats it as a message.</li> <li>Baotou plus package body length. The header is 4 bytes of fixed length, which indicates the length of the packet body. The receiving peer first receives the header length and receives the packet body according to the header length.</li> <li>Set boundaries between packets, such as adding special symbols <code>\r\n</code> mark. The FTP protocol does just that. The problem is that if the data body also contains <code>\r\n</code> , it will be misjudged as the message boundary.</li> <li>Use more complex application layer protocols.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP Flow Control</h4><a id="user-content-tcp-flow-control" class="anchor" aria-label="Permalink: TCP Flow Control" href="#tcp-flow-control"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Concept</h5><a id="user-content-concept-3" class="anchor" aria-label="Permalink: Concept" href="#concept-3"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Flow control is to make the sending rate of the sender not too fast, but to allow the receiver to receive it.</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Methods</h5><a id="user-content-methods" class="anchor" aria-label="Permalink: Methods" href="#methods"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Variable window for flow control</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/%E5%88%A9%E7%94%A8%E5%8F%AF%E5%8F%98%E7%AA%97%E5%8F%A3%E8%BF%9B%E8%A1%8C%E6%B5%81%E9%87%8F%E6%8E%A7%E5%88%B6%E4%B8%BE%E4%BE%8B.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/%E5%88%A9%E7%94%A8%E5%8F%AF%E5%8F%98%E7%AA%97%E5%8F%A3%E8%BF%9B%E8%A1%8C%E6%B5%81%E9%87%8F%E6%8E%A7%E5%88%B6%E4%B8%BE%E4%BE%8B.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP congestion control</h4><a id="user-content-tcp-congestion-control" class="anchor" aria-label="Permalink: TCP congestion control" href="#tcp-congestion-control"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Concept</h5><a id="user-content-concept-4" class="anchor" aria-label="Permalink: Concept" href="#concept-4"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Congestion control is to prevent excessive data from being injected into the network, so that the routers or links in the network will not be overloaded.</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Methods</h5><a id="user-content-methods-1" class="anchor" aria-label="Permalink: Methods" href="#methods-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Slow start</li> <li>Congestion avoidance</li> <li>Fast retransmit</li> <li>Fast recovery</li> </ul> <p dir="auto">TCP Congestion control graph</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8B%A5%E5%A1%9E%E7%AA%97%E5%8F%A3cwnd%E5%9C%A8%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%97%B6%E7%9A%84%E5%8F%98%E5%8C%96%E6%83%85%E5%86%B5.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E6%8B%A5%E5%A1%9E%E7%AA%97%E5%8F%A3cwnd%E5%9C%A8%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%97%B6%E7%9A%84%E5%8F%98%E5%8C%96%E6%83%85%E5%86%B5.png" alt="" style="max-width: 100%;"></a> <a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/%E5%BF%AB%E9%87%8D%E4%BC%A0%E7%A4%BA%E6%84%8F%E5%9B%BE.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/%E5%BF%AB%E9%87%8D%E4%BC%A0%E7%A4%BA%E6%84%8F%E5%9B%BE.png" alt="" style="max-width: 100%;"></a> <a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%B5%81%E7%A8%8B%E5%9B%BE.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%8B%A5%E5%A1%9E%E6%8E%A7%E5%88%B6%E6%B5%81%E7%A8%8B%E5%9B%BE.png" alt="" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP Transmission connection management</h4><a id="user-content-tcp-transmission-connection-management" class="anchor" aria-label="Permalink: TCP Transmission connection management" href="#tcp-transmission-connection-management"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">因为 TCP 三次握手建立连接、四次挥手释放连接很重要,所以附上《计算机网络(第 7 版)-谢希仁》书中对此章的详细描述:<a href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP-transport-connection-management.png" rel="nofollow">https://raw.githubusercontent.com/huihut/interview/master/images/TCP-transport-connection-management.png</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">TCP 三次握手建立连接</h5><a id="user-content-tcp-三次握手建立连接" class="anchor" aria-label="Permalink: TCP 三次握手建立连接" href="#tcp-三次握手建立连接"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%BB%BA%E7%AB%8B%E8%BF%9E%E6%8E%A5.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%BB%BA%E7%AB%8B%E8%BF%9E%E6%8E%A5.png" alt="UDP 报文" style="max-width: 100%;"></a></p> <p dir="auto">【Explain the whole process of TCP connection establishment】</p> <ol dir="auto"> <li>The client sends a SYN to the server, indicating that the client requests to establish a connection;</li> <li>The server receives the SYN sent by the client and replies with SYN + ACK to the client (agreeing to establish a connection);</li> <li>After receiving the SYN + ACK from the server, the client responds with an ACK to the server (indicating that the client received the consent message sent by the server);</li> <li>The server receives the ACK from the client, the connection is established, and data transmission is possible.</li> </ol> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Why does TCP have to shake hands three times?</h5><a id="user-content-why-does-tcp-have-to-shake-hands-three-times" class="anchor" aria-label="Permalink: Why does TCP have to shake hands three times?" href="#why-does-tcp-have-to-shake-hands-three-times"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">【Answer One】 Because the channel is unreliable, and TCP wants to establish a reliable transmission on the unreliable channel, then three communications is the theoretical minimum. (And UDP does not need to establish a reliable transmission, so UDP does not require a three-way handshake.)</p> <blockquote> <p dir="auto"><a href="https://groups.google.com/forum/#!msg/pongba/kF6O7-MFxM0/5S7zIJ4yqKUJ" rel="nofollow">Google Groups. Why is TCP a three-way handshake to establish a connection? {Technology} {Network Communication}</a></p> </blockquote> <p dir="auto">[Answer II] Because both parties need to confirm that the other party has received the serial number sent by themselves, the confirmation process requires at least three communications.</p> <blockquote> <p dir="auto"><a href="https://www.zhihu.com/question/24853633/answer/115173386" rel="nofollow">Know. Why is TCP a three-way handshake instead of two or four? </a></p> </blockquote> <p dir="auto">[Answer three] In order to prevent the invalid connection request segment from being sent to the server suddenly, an error is generated.</p> <blockquote> <p dir="auto"><a href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP-transport-connection-management.png" rel="nofollow">"Computer Network (7th Edition) -Xie Xiren"</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">TCP Four waves to release the connection</h5><a id="user-content-tcp-four-waves-to-release-the-connection" class="anchor" aria-label="Permalink: TCP Four waves to release the connection" href="#tcp-four-waves-to-release-the-connection"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B%E9%87%8A%E6%94%BE%E8%BF%9E%E6%8E%A5.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B%E9%87%8A%E6%94%BE%E8%BF%9E%E6%8E%A5.png" alt="UDP 报文" style="max-width: 100%;"></a></p> <p dir="auto">【TCP Four waves to release the connection】</p> <ol dir="auto"> <li>The client sends FIN to the server, indicating that the client does not need to send data to the server (request to release the connection from the client to the server);</li> <li>The server receives the FIN sent by the client and replies ACK to the client (agreeing to release the connection from the client to the server);</li> <li>The client receives the ACK from the server, and the connection from the client to the server has been released (but the connection from the server to the client has not been released, and the client can still receive data);</li> <li>The server continues to send the unfinished data to the client;</li> <li>The server sends FIN + ACK to the client, indicating that the server has sent the data (request to release the connection from the server to the client, even if no reply is received from the client, it will be automatically released after a certain period of time);</li> <li>The client receives the FIN + ACK from the server and replies to the server with an ACK (agreeing to release the connection from the server to the client);</li> <li>After receiving the ACK from the client, the server releases the connection from the server to the client.</li> </ol> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Why does TCP have to wave four times?</h5><a id="user-content-why-does-tcp-have-to-wave-four-times" class="anchor" aria-label="Permalink: Why does TCP have to wave four times?" href="#why-does-tcp-have-to-wave-four-times"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[Question 1] Why does TCP wave four times? / Why does TCP need three times to establish a connection and four times to release a connection?</p> <p dir="auto">[Answer One] Because TCP is in full-duplex mode, after the client requests to close the connection, the connection from the client to the server is closed (one or two waves), and the server continues to transmit the data that has not been previously transmitted to the client (data transmission) , The connection from the server to the client is closed (waving three or four times). Therefore, when TCP releases the connection, the server's ACK and FIN are sent separately (with data transmission in between), and when the TCP establishes the connection, the server's ACK and SYN are sent together (second handshake), so TCP needs to establish the connection three times. It takes four times to release the connection.</p> <p dir="auto">[Question 2] Why can ACK and SYN be sent together when TCP is connected, and ACK and FIN are sent separately when released? (ACK and FIN refer to the second and third wave)</p> <p dir="auto">[Answer 2:] When the client requests the release, the server may still have data to transmit to the client, so the server must respond to the client FIN request (the server sends an ACK), and then the data is transmitted. After the transmission is completed, the server then Make a FIN request (the server sends FIN); there is no intermediate data transmission when connecting, so ACK and SYN can be sent together when connecting.</p> <p dir="auto">[Question three] Why does the client need TIME-WAIT to wait for 2MSL at the end?</p> <p dir="auto">【Answer three】</p> <ol dir="auto"> <li>In order to ensure that the last ACK message sent by the client can reach the server. If it fails to arrive, the server will retransmit the FIN + ACK segment overtime, and the client will retransmit the ACK and re-time.</li> <li>Prevent invalid connection request segments from appearing in this connection. When TIME-WAIT lasts 2MSL, all the segments generated during the duration of this connection will disappear from the network, so that the old connection segments will not appear in the next connection.</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP finite state machine</h4><a id="user-content-tcp-finite-state-machine" class="anchor" aria-label="Permalink: TCP finite state machine" href="#tcp-finite-state-machine"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">TCP finite state machine picture</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%9C%89%E9%99%90%E7%8A%B6%E6%80%81%E6%9C%BA.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/TCP%E7%9A%84%E6%9C%89%E9%99%90%E7%8A%B6%E6%80%81%E6%9C%BA.png" alt="TCP Finite state machine" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Application layer</h3><a id="user-content-application-layer" class="anchor" aria-label="Permalink: Application layer" href="#application-layer"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">DNS</h4><a id="user-content-dns" class="anchor" aria-label="Permalink: DNS" href="#dns"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>DNS (Domain Name System) is a service of the Internet. It serves as a distributed database that maps domain names and IP addresses to each other, enabling people to access the Internet more conveniently. DNS uses TCP and UDP port 53. Currently, the limit for the length of each domain name is 63 characters, and the total length of the domain name cannot exceed 253 characters.</li> </ul> <p dir="auto">domain name:</p> <ul dir="auto"> <li><code>Domain name :: = {<third-level domain name>.<Second-level domain name>.<Top-level domain name>}</code>, for example: <code>blog.huihut.com</code></li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">FTP</h4><a id="user-content-ftp" class="anchor" aria-label="Permalink: FTP" href="#ftp"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>FTP (File Transfer Protocol, file transfer protocol) is a set of standard protocols for file transfer on the network, using the client / server model, using TCP datagrams, providing interactive access, two-way transmission.</li> <li>TFTP (Trivial File Transfer Protocol) is a small and easy-to-implement file transfer protocol. It also uses the client-server method and uses UDP datagrams. It only supports file transfers and does not support interaction. User authentication</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TELNET</h4><a id="user-content-telnet" class="anchor" aria-label="Permalink: TELNET" href="#telnet"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li> <p dir="auto">The TELNET protocol is a member of the TCP / IP protocol family and is the standard protocol and main method of the Internet remote login service. It provides users with the ability to complete remote host work on the local computer.</p> </li> <li> <p dir="auto">HTTP (HyperText Transfer Protocol) is a transfer protocol used to transfer hypertext from a WWW (World Wide Web, World Wide Web) server to a local browser.</p> </li> <li> <p dir="auto">SMTP (Simple Mail Transfer Protocol) is a set of rules for transferring mail from the source address to the destination address, which controls the transfer method of the letter. The SMTP protocol belongs to the TCP / IP protocol suite, which helps each computer find the next destination when sending or transferring letters.</p> </li> <li> <p dir="auto">Socket requires at least a pair of port numbers (Socket) to establish a network communication connection. Socket is essentially a programming interface (API), which encapsulates TCP / IP. TCP / IP also provides an interface that programmers can use for network development. This is the Socket programming interface.</p> </li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">WWW</h4><a id="user-content-www" class="anchor" aria-label="Permalink: WWW" href="#www"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>WWW (World Wide Web, World Wide Web, World Wide Web) is a system composed of many hypertext links to each other, accessed via the Internet</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">URL</h5><a id="user-content-url" class="anchor" aria-label="Permalink: URL" href="#url"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>URL (Uniform Resource Locator) is a standard resource address (Address) on the Internet</li> </ul> <p dir="auto">standard format:</p> <ul dir="auto"> <li><code>Protocol type: [// server address [: port number]] [/ resource level UNIX file path] file name [? Query] [# Clip ID]</code></li> </ul> <p dir="auto">Complete format:</p> <ul dir="auto"> <li><code>Protocol type: [// [Credential information required to access resources @] server address [: port number]] [/ resource level UNIX file path] file name [? Query] [# segment ID]</code></li> </ul> <blockquote> <p dir="auto">Among them [access credential information @ ;: port number ;? query; #fragment ID] are all optional items For example: <code>https://github.com/huihut/interview#cc</code></p> </blockquote> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">HTTP</h5><a id="user-content-http" class="anchor" aria-label="Permalink: HTTP" href="#http"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Hypertext Transfer Protocol (HTTP) is an application-layer protocol for distributed, collaborative, and hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web.</p> <p dir="auto">Request method</p> <markdown-accessiblity-table><table> <thead> <tr> <th>Method</th> <th>meaning</th> </tr> </thead> <tbody> <tr> <td>OPTIONS</td> <td>Request some option information to allow clients to view server performance</td> </tr> <tr> <td>GET</td> <td>Request the specified page information and return the entity body</td> </tr> <tr> <td>HEAD</td> <td>Similar to a get request, except that there is no specific content in the returned response, which is used to get the header</td> </tr> <tr> <td>POST</td> <td>Submits data to a specified resource for processing requests (such as submitting a form or uploading a file). The data is contained in the request body. POST requests may result in the creation of new resources and / or modification of existing resources</td> </tr> <tr> <td>PUT</td> <td>Data transmitted from the client to the server replaces the contents of the specified document</td> </tr> <tr> <td>DELETE</td> <td>request the server to delete the specified page</td> </tr> <tr> <td>TRACE</td> <td>echo requests received by the server, mainly for testing or diagnostics</td> </tr> </tbody> </table></markdown-accessiblity-table> <p dir="auto">Status Code</p> <ul dir="auto"> <li>1xx: indicates notification information, such as the request has been received or is being processed <ul dir="auto"> <li>100 Continue: Continue, the client should continue its request</li> <li>101 Switching Protocols. The server switches protocols according to the client's request. Can only switch to higher-level protocols, for example, to new versions of HTTP</li> </ul> </li> <li>2xx: indicates success, such as receiving or knowing <ul dir="auto"> <li>200 OK: The request was successful</li> </ul> </li> <li>3xx: indicates a redirect, and further action is required to complete the request <ul dir="auto"> <li>301 Moved Permanently: Move permanently. The requested resource has been permanently moved to the new URL, the returned information will include the new URL, and the browser will automatically be directed to the new URL. Any future requests should use the new URL instead</li> </ul> </li> <li>4xx: indicates a customer error, such as incorrect syntax in the request or inability to complete <ul dir="auto"> <li>400 Bad Request: The client requested a syntax error that the server could not understand</li> <li>401 Unauthorized: request requires user authentication</li> <li>403 Forbidden: The server understood the request from the requesting client, but refused to execute the request (insufficient permissions)</li> <li>404 Not Found: The server cannot find the resource (web page) based on the client's request. With this code, the website designer can set a personality page for "the resource you requested could not be found"</li> <li>408 Request Timeout: The server waited too long for the request sent by the client, timed out</li> </ul> </li> <li>5xx: indicates a server error, such as the server failing to complete the request <ul dir="auto"> <li>500 Internal Server Error: Server internal error, unable to complete request</li> <li>503 Service Unavailable: Due to overload or system maintenance, the server cannot temporarily process the client's request. The length of the delay can be included in the server's Retry-After header</li> <li>504 Gateway Timeout: The server acting as a gateway or proxy, not receiving requests from the remote server in a timely manner</li> </ul> </li> </ul> <blockquote> <p dir="auto">More status codes: <a href="http://www.runoob.com/http/http-status-codes.html" rel="nofollow">Rookie Tutorials. HTTP Status Codes</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Other agreements</h5><a id="user-content-other-agreements" class="anchor" aria-label="Permalink: Other agreements" href="#other-agreements"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>SMTP (Simple Main Transfer Protocol, Simple Mail Transfer Protocol) is a standard for transmitting Email over the Internet. It is a relatively simple text-based protocol. One or more recipients of a message are specified on top of it (confirmed to exist in most cases), and the message text is transmitted. You can easily test an SMTP server through a Telnet program. SMTP uses TCP port 25.</li> <li>DHCP (Dynamic Host Configuration Protocol) is a network protocol for a local area network. It uses the UDP protocol to work and has two main purposes: <ul dir="auto"> <li>For internal network or network service provider to automatically assign IP addresses to users</li> <li>For internal network administrators as a means of central management of all computers</li> </ul> </li> <li>SNMP (Simple Network Management Protocol) forms part of the Internet protocol family defined by the Internet Engineering Task Force (IETF). The protocol can support a network management system to monitor whether the devices connected to the network have any management concerns.</li> </ul> <p dir="auto"><a id="user-content-network-programming"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">🌩 Network Programming</h2><a id="user-content--network-programming" class="anchor" aria-label="Permalink: 🌩 Network Programming" href="#-network-programming"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Socket</h3><a id="user-content-socket" class="anchor" aria-label="Permalink: Socket" href="#socket"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto"><a href="https://www.cnblogs.com/skynet/archive/2010/12/12/1903949.html" rel="nofollow">Linux Socket Programming (unlimited Linux)</a></p> </blockquote> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/socket%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%80%9A%E8%AE%AF.jpg"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/socket%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%80%9A%E8%AE%AF.jpg" alt="Socket Client server communication" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Socket middle read()、write() function</h4><a id="user-content-socket-middle-readwrite-function" class="anchor" aria-label="Permalink: Socket middle read()、write() function" href="#socket-middle-readwrite-function"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="ssize_t read(int fd, void *buf, size_t count); ssize_t write(int fd, const void *buf, size_t count);"><pre><span class="pl-c1">ssize_t</span> <span class="pl-en">read</span>(<span class="pl-k">int</span> fd, <span class="pl-k">void</span> *buf, <span class="pl-c1">size_t</span> count); <span class="pl-c1">ssize_t</span> <span class="pl-en">write</span>(<span class="pl-k">int</span> fd, <span class="pl-k">const</span> <span class="pl-k">void</span> *buf, <span class="pl-c1">size_t</span> count);</pre></div> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">read()</h5><a id="user-content-read" class="anchor" aria-label="Permalink: read()" href="#read"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>The read function is responsible for reading content from fd.</li> <li>When the read is successful, read returns the actual number of bytes read.</li> <li>If the returned value is 0, it means that the end of the file has been read, and if it is less than 0, an error has occurred.</li> <li>If the error is EINTR, the reading is caused by interruption; if it is ECONNREST, there is a problem with the network connection.</li> </ul> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">write ()</h5><a id="user-content-write-" class="anchor" aria-label="Permalink: write ()" href="#write-"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>The write function writes the contents of nbytes in buf to the file descriptor fd.</li> <li>Returns the number of bytes written when successful. On failure, it returns -1 and sets the errno variable.</li> <li>In network programs, there are two possibilities when we write to the socket file descriptor.</li> <li>(1) The return value of write is greater than 0, indicating that part or all of the data has been written.</li> <li>(2) The returned value is less than 0, and an error has occurred at this time.</li> <li>If the error is EINTR, it indicates that an interruption error occurred during writing; if it is EPIPE, it indicates that there is a problem with the network connection (the other party has closed the connection).</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP three-way handshake in socket to establish connection</h4><a id="user-content-tcp-three-way-handshake-in-socket-to-establish-connection" class="anchor" aria-label="Permalink: TCP three-way handshake in socket to establish connection" href="#tcp-three-way-handshake-in-socket-to-establish-connection"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">We know that TCP establishes a connection by performing a "three-way handshake", that is, exchanging three packets. The general process is as follows:</p> <ol dir="auto"> <li>The client sends a SYN J to the server</li> <li>The server responds to the client with a SYN K, and confirms SYN J ACK J + 1</li> <li>The client wants the server to send an acknowledgement ACK K + 1</li> </ol> <p dir="auto">Only the three-way handshake is finished, but what about the three-way handshake in the socket function? Please see the picture below:</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/a26c11ef7b59f36bb6ab2616cd9bcdd5e241958e1123b35b5272174b9c9de899/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373436373235382e706e67"><img src="https://camo.githubusercontent.com/a26c11ef7b59f36bb6ab2616cd9bcdd5e241958e1123b35b5272174b9c9de899/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373436373235382e706e67" alt="socket Sent in TCP Three handshake" data-canonical-src="http://images.cnblogs.com/cnblogs_com/skynet/201012/201012122157467258.png" style="max-width: 100%;"></a></p> <p dir="auto">It can be seen from the figure:</p> <ol dir="auto"> <li>When the client calls connect, a connection request is triggered and a SYN J packet is sent to the server. At this time, connect enters a blocking state;</li> <li>The server listens to the connection request, that is, receives the SYN J packet, calls the accept function to receive the request and sends SYN K and ACK J + 1 to the client, then accept enters the blocking state;</li> <li>After the client receives the SYN K of the server, ACK J + 1, connect returns at this time, and confirms the SYN K;</li> <li>When the server receives ACK K + 1, accept returns, so that the three handshake is completed and the connection is established.</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">TCP four-way handshake in socket to release connection</h4><a id="user-content-tcp-four-way-handshake-in-socket-to-release-connection" class="anchor" aria-label="Permalink: TCP four-way handshake in socket to release connection" href="#tcp-four-way-handshake-in-socket-to-release-connection"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The above describes the three-way handshake establishment process of TCP in socket and the socket functions involved. Now we introduce the process of releasing the connection by the four-way handshake in the socket, please see the following figure:</p> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/72145f6906c6fe8b825866a209809d5a33f4d144f76c5e7ccabfd489d70fba89/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373438373631362e706e67"><img src="https://camo.githubusercontent.com/72145f6906c6fe8b825866a209809d5a33f4d144f76c5e7ccabfd489d70fba89/687474703a2f2f696d616765732e636e626c6f67732e636f6d2f636e626c6f67735f636f6d2f736b796e65742f3230313031322f3230313031323132323135373438373631362e706e67" alt="socket TCP four-way handshake sent in" data-canonical-src="http://images.cnblogs.com/cnblogs_com/skynet/201012/201012122157487616.png" style="max-width: 100%;"></a></p> <p dir="auto">The illustrated process is as follows:</p> <ol dir="auto"> <li>An application process first calls close to actively close the connection, then TCP sends a FIN M;</li> <li>After receiving the FIN M, the other end performs a passive close to confirm the FIN. Its reception is also passed to the application process as an end-of-file character, because the reception of FIN means that the application process can no longer receive additional data on the corresponding connection;</li> <li>After a period of time, the application process that received the end-of-file character calls close to close its socket. This causes its TCP to also send a FIN N;</li> <li>The source TCP that received the FIN confirms it.</li> </ol> <p dir="auto">So there is a FIN and ACK in each direction.</p> <p dir="auto"><a id="user-content-database"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">💾 Database</h2><a id="user-content--database" class="anchor" aria-label="Permalink: 💾 Database" href="#-database"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">Part of the knowledge in this section comes from "Introduction to Database Systems (5th Edition)"</p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">basic concepts</h3><a id="user-content-basic-concepts" class="anchor" aria-label="Permalink: basic concepts" href="#basic-concepts"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Data: Symbolic records describing things are called data.</li> <li>Database (DB): It is a collection of a large amount of organized, shareable data stored in a computer for a long time, and has three basic characteristics of permanent storage, organization, and shareability.</li> <li>Database Management System (DBMS): is a layer of data management software located between the user and the operating system.</li> <li>Database system (DBS): is a system consisting of a database, a database management system (and its application development tools), applications, and a database administrator (DBA) to store, manage, process, and maintain data.</li> <li>Entity: Objects that exist objectively and can be distinguished from each other are called entities.</li> <li>Attribute: An attribute of an entity is called an attribute.</li> <li>Key: The set of attributes that uniquely identify an entity is called a key.</li> <li>Entity type: Use entity name and its attribute name set to abstract and characterize similar entities, called entity type.</li> <li>Entity set: A set of the same entity type is called an entity set.</li> <li>Relationship: The relationship between entities usually refers to the connection between different sets of entities.</li> <li>Schema: A schema is also called a logical schema. It is a description of the logical structure and characteristics of the entire database data. It is a common data view for all users.</li> <li>External schema: External schema is also called subschema or user schema. It is a description of the logical structure and characteristics of local data that database users (including application programmers and end users) can see and use. A database user's data view is a logical representation of data related to an application.</li> <li>Internal schema: Internal schema is also called storage schema. A database has only one internal schema. It is a description of the physical structure and storage of the data, and the way the database is organized within the database.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Common data models</h3><a id="user-content-common-data-models" class="anchor" aria-label="Permalink: Common data models" href="#common-data-models"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Hierarchical model</li> <li>Network model</li> <li>Relational model <ul dir="auto"> <li>Relation (relation): a relation corresponds to a table</li> <li>Tuple: a row in the table is a tuple</li> <li>Attribute (attribute): a column in the table is an attribute</li> <li>Key: A certain attribute group of a tuple can be uniquely identified in the table</li> <li>Domain (domain): a set of values of the same data type</li> <li>Component: an attribute value in a tuple</li> <li>Relation mode: description of the relationship, generally expressed as <code>relation name (attribute 1, attribute 2, ..., attribute n)</code></li> </ul> </li> <li>Object oriented data model</li> <li>Object relational data model</li> <li>Semistructured data model</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Common SQL Operations</h3><a id="user-content-common-sql-operations" class="anchor" aria-label="Permalink: Common SQL Operations" href="#common-sql-operations"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <tbody><tr> <th> Object type </th><th> Object </th><th> Type of operation </th></tr><tr> <td rowspan="4"> Database mode </td><td> Mode </td><td> <code> CREATE SCHEMA </code></td></tr><tr> <td> Basic table </td><td> <code> CREATE SCHEMA , <code> ALTER TABLE </code></code></td></tr><tr> <td> View </td><td> <code> CREATE VIEW </code></td></tr><tr> <td> Index </td><td> <code> CREATE INDEX </code></td></tr><tr> <td rowspan="2"> Data </td><td> Basic tables and views </td><td> <code> SELECT , <code> INSERT , <code> UPDATE , <code> DELETE , <code> REFERENCES , <code> ALL PRIVILEGES </code></code></code></code></code></code></td></tr><tr> <td> Attribute column </td><td> <code> SELECT , <code> INSERT , <code> UPDATE , <code> REFERENCES , <code> ALL PRIVILEGES </code></code></code></code></code></td></tr></tbody></table></markdown-accessiblity-table> <blockquote> <p dir="auto">SQL Grammar Tutorial: <a href="http://www.runoob.com/sql/sql-tutorial.html" rel="nofollow">runoob . SQL Tutorial</a></p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Relational Database</h3><a id="user-content-relational-database" class="anchor" aria-label="Permalink: Relational Database" href="#relational-database"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Basic relation operations: query (selection, projection, connection (equivalent connection, natural connection, outer connection (left outer connection, right outer connection)), division, union, difference, intersection, Cartesian product, etc.), insertion, deletion ,modify</li> <li>Three types of integrity constraints in the relationship model: entity integrity, referential integrity, user-defined integrity</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Index</h4><a id="user-content-index" class="anchor" aria-label="Permalink: Index" href="#index"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Database index: sequential index, B + tree index, hash index</li> <li><a href="http://blog.codinglabs.org/articles/theory-of-mysql-index.html" rel="nofollow">Data structure and algorithm principle behind MySQL index</a></li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Database integrity</h3><a id="user-content-database-integrity" class="anchor" aria-label="Permalink: Database integrity" href="#database-integrity"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Database integrity refers to the correctness and compatibility of data. <ul dir="auto"> <li>Integrity: To prevent non-semantic (incorrect) data from the database.</li> <li>Security: In order to protect the database from malicious damage and illegal access.</li> </ul> </li> <li>Trigger: is a special event-driven process defined by the user in the relational table.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Relational data theory</h3><a id="user-content-relational-data-theory" class="anchor" aria-label="Permalink: Relational data theory" href="#relational-data-theory"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Data dependency is a constraint relationship between the internal attributes and attributes of a relationship. It is a correlation between data that is reflected by the equality of the values between attributes.</li> <li>The most important data dependencies: function dependencies, multi-value dependencies.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Paradigm</h4><a id="user-content-paradigm" class="anchor" aria-label="Permalink: Paradigm" href="#paradigm"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>First Normal Form (1NF): The attribute (field) is the smallest unit and cannot be separated.</li> <li>The second normal form (2NF): meet 1NF, each non-primary attribute completely depends on the primary key (eliminating the partial function dependence of 1NF non-primary attribute on the code).</li> <li>The third normal form (3NF): 2NF is satisfied, and any non-primary attribute does not depend on other non-primary attributes (eliminating the 2NF non-primary attribute's transfer function dependence on the code).</li> <li>Bowies-Kode Normal Form (BCNF): Satisfy 3NF, any non-primary attribute cannot depend on the subset of primary keys (eliminating the 3NF primary attribute's dependence on the code part and transfer function)</li> <li>The fourth normal form (4NF): meet 3NF, there must be non-trivial and non-functional dependent multi-value dependencies between attributes (eliminating 3NF non-trivial and non-functional multi-value dependencies).</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Database Recovery</h3><a id="user-content-database-recovery" class="anchor" aria-label="Permalink: Database Recovery" href="#database-recovery"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Transaction: It is a user-defined sequence of database operations. These operations are either all done or not done at all. It is an indivisible unit of work.</li> <li>ACID characteristics of things: atomicity, consistency, isolation, persistence.</li> <li>Implementation technology of recovery: establish redundant data-> use redundant data to implement database recovery.</li> <li>Common techniques for establishing redundant data: data dumps (dynamic mass dumps, dynamic incremental dumps, static mass dumps, static incremental dumps), registration log files.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Concurrency control</h3><a id="user-content-concurrency-control" class="anchor" aria-label="Permalink: Concurrency control" href="#concurrency-control"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Transactions are the basic unit of concurrency control.</li> <li>Data inconsistencies caused by concurrent operations include: lost modifications, non-repeatable reads, and "dirty" data reads.</li> <li>The main technologies of concurrency control: blocking, timestamp, optimistic control method, multi-version concurrency control, etc.</li> <li>Basic lock types: exclusive lock (X lock / write lock), shared lock (S lock / read lock).</li> <li>Livelock deadlock: <ul dir="auto"> <li>Livelock: The transaction is always in a waiting state, which can be avoided through a first come, first served policy.</li> <li>Deadlock: The transaction can never end <ul dir="auto"> <li>Prevention: one-time block method, sequential block method;</li> <li>Diagnosis: timeout method, waiting graph method;</li> <li>Cancel: Undo the transaction with the least deadlock cost and release all the locks of this transaction, so that other transactions can continue to run.</li> </ul> </li> </ul> </li> <li>Serializable scheduling: The concurrent execution of multiple transactions is correct if and only if the result is the same as when the transactions are executed serially in a certain order. Guidelines for correct scheduling of concurrent transactions when serializable.</li> </ul> <p dir="auto"><a id="user-content-design-pattern"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">📏 Design pattern</h2><a id="user-content--design-pattern" class="anchor" aria-label="Permalink: 📏 Design pattern" href="#-design-pattern"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">Examples of major design patterns: <a href="https://blog.csdn.net/liang19890820/article/details/66974516" rel="nofollow">CSDN column. C ++ Design Patterns</a> series of blog posts</p> </blockquote> <p dir="auto"><a href="/huihut/interview/blob/master/DesignPattern">Design Pattern Project Catalog</a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Singleton mode</h3><a id="user-content-singleton-mode" class="anchor" aria-label="Permalink: Singleton mode" href="#singleton-mode"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DesignPattern/SingletonPattern">Singleton Pattern Example</a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Abstract factory pattern</h3><a id="user-content-abstract-factory-pattern" class="anchor" aria-label="Permalink: Abstract factory pattern" href="#abstract-factory-pattern"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DesignPattern/AbstractFactoryPattern">Abstract Factory Pattern Example</a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Adapter Mode</h3><a id="user-content-adapter-mode" class="anchor" aria-label="Permalink: Adapter Mode" href="#adapter-mode"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DesignPattern/AdapterPattern">Adapter pattern example</a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Bridge mode</h3><a id="user-content-bridge-mode" class="anchor" aria-label="Permalink: Bridge mode" href="#bridge-mode"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DesignPattern/BridgePattern">Bridge pattern example</a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Observer mode</h3><a id="user-content-observer-mode" class="anchor" aria-label="Permalink: Observer mode" href="#observer-mode"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="/huihut/interview/blob/master/DesignPattern/ObserverPattern">Example of Observer Pattern</a></p> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Six Principles of Design Patterns</h3><a id="user-content-six-principles-of-design-patterns" class="anchor" aria-label="Permalink: Six Principles of Design Patterns" href="#six-principles-of-design-patterns"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Single Responsibility Principle (SRP)</li> <li>Liskov Substitution Principle (LSP)</li> <li>Dependence Inversion Principle (DIP)</li> <li>Interface Segregation Principle (ISP)</li> <li>Law of Demeter (LoD)</li> <li>Open Close Principle (OCP)</li> </ul> <p dir="auto"><a id="user-content-link-loading-library"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">⚙️ Link Loading Library</h2><a id="user-content-️-link-loading-library" class="anchor" aria-label="Permalink: ⚙️ Link Loading Library" href="#️-link-loading-library"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">Part of the knowledge in this section comes from "Programmer's Self-Cultivation-Link Loading Library"</p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">memory, stack, heap</h3><a id="user-content-memory-stack-heap" class="anchor" aria-label="Permalink: memory, stack, heap" href="#memory-stack-heap"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The general application memory space has the following areas:</p> <ul dir="auto"> <li>Stack: Automatically allocated and released by the operating system, storing function parameter values, local variable values, etc., used to maintain the context of function calls</li> <li>Heap: Generally allocated and released by the programmer. If the programmer does not release, it may be recycled by the operating system at the end of the program to accommodate the dynamically allocated memory area of the application.</li> <li>Executable image: Stores the image of the executable file in memory. Loading by the loader is to read or map the memory of the executable file here.</li> <li>Reserved area: The reserved area is not a single memory area, but a general term for memory areas that are protected from access in the memory. For example, in C, the invalid pointer is assigned a value of 0 (NULL), so the 0 address is normal. Impossible to access data efficiently</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">stack</h4><a id="user-content-stack" class="anchor" aria-label="Permalink: stack" href="#stack"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The stack stores the maintenance information required for a function call. It is often called a stack frame or an active record. It generally contains the following aspects:</p> <ul dir="auto"> <li>Function return address and parameters</li> <li>Temporary variables: including non-static local variables of functions and other temporary variables automatically generated by the compiler</li> <li>Save context: including registers that need to remain unchanged before and after function calls</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Heap</h4><a id="user-content-heap" class="anchor" aria-label="Permalink: Heap" href="#heap"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Heap allocation algorithm:</p> <ul dir="auto"> <li>Free List</li> <li>Bitmap</li> <li>Object pool</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">"Segment fault" or "Illegal operation, this memory address cannot be read / write"</h4><a id="user-content-segment-fault-or-illegal-operation-this-memory-address-cannot-be-read--write" class="anchor" aria-label="Permalink: "Segment fault" or "Illegal operation, this memory address cannot be read / write"" href="#segment-fault-or-illegal-operation-this-memory-address-cannot-be-read--write"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Errors caused by typical illegal pointer dereferencing. This error occurs when the pointer points to a memory address that is not allowed to read and write, and the program attempts to use the pointer to read or write that address.</p> <p dir="auto">Common reasons:</p> <ul dir="auto"> <li>Initialize the pointer to NULL, then start using the pointer without giving it a reasonable value</li> <li>There is no need to initialize the pointer in the stack. The value of the pointer will generally be a random number. After that, the pointer is used directly.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Compile and link</h3><a id="user-content-compile-and-link" class="anchor" aria-label="Permalink: Compile and link" href="#compile-and-link"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">File formats for each platform</h4><a id="user-content-file-formats-for-each-platform" class="anchor" aria-label="Permalink: File formats for each platform" href="#file-formats-for-each-platform"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Platform</th> <th>Executables</th> <th>Objects</th> <th>Dynamic Libraries / Shared Objects</th> <th>Static Libraries</th> </tr> </thead> <tbody> <tr> <td>Windows</td> <td>exe</td> <td>obj</td> <td>dll</td> <td>lib</td> </tr> <tr> <td>Unix/Linux</td> <td>ELF、out</td> <td>o</td> <td>so</td> <td>a</td> </tr> <tr> <td>Mac</td> <td>Mach-O</td> <td>o</td> <td>dylib、tbd、framework</td> <td>a、framework</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Compile and link process</h4><a id="user-content-compile-and-link-process" class="anchor" aria-label="Permalink: Compile and link process" href="#compile-and-link-process"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Pre-compilation (pre-compiler processes pre-compilation instructions such as <code># include</code>,<code> # define</code> and generates <code>.i</code> or<code> .ii</code> files)</li> <li>Compile (the compiler performs lexical analysis, syntax analysis, semantic analysis, intermediate code generation, object code generation, optimization, and generation of <code>.s</code> files)</li> <li>Assembly (the assembler translates the assembly code into machine code and generates a <code>.o</code> file)</li> <li>Linking (connectors perform address and space allocation, symbol resolution, relocation, and generate <code>.out</code> files)</li> </ol> <blockquote> <p dir="auto">The current version of GCC combines pre-compilation and compilation into one step, pre-compiled compiler cc1, assembler as, linker ld</p> </blockquote> <blockquote> <p dir="auto">MSVC compilation environment, compiler cl, linker link, executable file viewer dumpbin</p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">target document</h4><a id="user-content-target-document" class="anchor" aria-label="Permalink: target document" href="#target-document"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">The files generated by the compiler after compiling the source code are called object files. The object file is structurally speaking, it is a compiled executable file format, but the linking process has not yet been performed, and some symbols or addresses may not be adjusted.</p> <blockquote> <p dir="auto">Executable files (<code>.exe</code> for Windows and<code> ELF</code> for Linux), dynamic link libraries (<code>.dll</code> for Windows and<code> .so</code> for Linux), static link libraries (<code>.lib</code> for Windows and Linux <code>.A</code>) are stored according to the executable file format (Windows according to PE-COFF, Linux according to ELF)</p> </blockquote> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Object file format</h5><a id="user-content-object-file-format" class="anchor" aria-label="Permalink: Object file format" href="#object-file-format"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Windows PE (Portable Executable), or PE-COFF, <code>.obj</code> format</li> <li>Linux's ELF (Executable Linkable Format), <code>.o</code> format</li> <li>Intel / Microsoft OMF (Object Module Format)</li> <li>Unix <code>a.out</code> format</li> <li>MS-DOS <code>.COM</code> format</li> </ul> <blockquote> <p dir="auto">PE and ELF are both COFF (Common File Format) variants</p> </blockquote> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">Object file storage structure</h5><a id="user-content-object-file-storage-structure" class="anchor" aria-label="Permalink: Object file storage structure" href="#object-file-storage-structure"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Segment</th> <th>Function</th> </tr> </thead> <tbody> <tr> <td>File Header</td> <td>File header, describing the file attributes of the entire file (including whether the file is executable, is it statically linked or dynamically linked with the entry address, target hardware, target operating system, etc.)</td> </tr> <tr> <td>.text section</td> <td>Code section, machine code compiled by the execution statement</td> </tr> <tr> <td>.data section</td> <td>Data section, initialized global and local static variables</td> </tr> <tr> <td>.bss section</td> <td>BSS section (Block Started by Symbol), uninitialized global and local static variables (because the default value is 0, so it is only reserved here and does not take up space)</td> </tr> <tr> <td>.rodata section</td> <td>Read-only data section, which stores read-only data, generally read-only variables (such as const-modified variables) and string constants in the program</td> </tr> <tr> <td>.comment section</td> <td>Comment section for compiler version information</td> </tr> <tr> <td>.note.GNU-stack section</td> <td>Stack hint section</td> </tr> </tbody> </table></markdown-accessiblity-table> <blockquote> <p dir="auto">Other paragraphs omitted</p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Linked Interface-Symbol</h4><a id="user-content-linked-interface-symbol" class="anchor" aria-label="Permalink: Linked Interface-Symbol" href="#linked-interface-symbol"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">In the link, the object files are actually a reference to the address between the object files, that is, a reference to the address of a function and a variable. We collectively refer to functions and variables as Symbols, and function names or variable names are Symbol Names.</p> <p dir="auto">The following Symbol Table:</p> <markdown-accessiblity-table><table> <thead> <tr> <th>Symbol (Symbol Name)</th> <th>Symbol Value (Address)</th> </tr> </thead> <tbody> <tr> <td>main</td> <td>0x100</td> </tr> <tr> <td>Add</td> <td>0x123</td> </tr> <tr> <td>...</td> <td>...</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Shared Library for Linux</h3><a id="user-content-shared-library-for-linux" class="anchor" aria-label="Permalink: Shared Library for Linux" href="#shared-library-for-linux"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Shared libraries under Linux are ordinary ELF shared objects.</p> <p dir="auto">The shared library version update should ensure the compatibility of the binary interface ABI (Application Binary Interface)</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Name</h4><a id="user-content-name" class="anchor" aria-label="Permalink: Name" href="#name"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><code>libname.so.x.y.z</code></p> <ul dir="auto"> <li>x: major version number, libraries with different major version numbers are not compatible and need to be recompiled</li> <li>y: minor version number, higher version number is backward compatible with lower version number</li> <li>z: release version number, no interface changes, fully compatible</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">path</h4><a id="user-content-path" class="anchor" aria-label="Permalink: path" href="#path"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Most open source systems, including Linux, follow the FHS (File Hierarchy Standard) standard. This standard specifies how system files are stored, including various directory structures, organizations, and roles.</p> <ul dir="auto"> <li><code>/lib</code>: Stores the most critical and basic shared libraries of the system, such as dynamic linker, C language runtime library, math library, etc.</li> <li><code>/usr/lib</code>: Stores key libraries required by non-system runtime, mainly development libraries</li> <li><code>/usr/local/lib</code>: Stores libraries that are not very relevant to the operating system itself, mainly libraries for some third-party applications</li> </ul> <blockquote> <p dir="auto">The dynamic linker looks for shared libraries in <code>/ lib</code>, <code>/usr/lib</code>, and specified by the <code>/etc/ld.so.conf</code> configuration file</p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Environment variables</h4><a id="user-content-environment-variables" class="anchor" aria-label="Permalink: Environment variables" href="#environment-variables"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><code>LD_LIBRARY_PATH</code>: temporarily change the shared library search path of an application without affecting other applications</li> <li><code>LD_PRELOAD</code>: specify some shared libraries or even object files that are pre-loaded</li> <li><code>LD_DEBUG</code>: Turn on the debugging function of the dynamic linker</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">So shared library writing</h4><a id="user-content-so-shared-library-writing" class="anchor" aria-label="Permalink: So shared library writing" href="#so-shared-library-writing"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Writing shared libraries with CLion</p> <p dir="auto">Create a shared library named MySharedLib</p> <p dir="auto">CMakeLists.txt</p> <div class="highlight highlight-source-cmake notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cmake_minimum_required(VERSION 3.10) project(MySharedLib) set(CMAKE_CXX_STANDARD 11) add_library(MySharedLib SHARED library.cpp library.h)"><pre><span class="pl-k">cmake_minimum_required</span>(<span class="pl-e">VERSION</span> 3.10) <span class="pl-k">project</span>(MySharedLib) <span class="pl-k">set</span>(CMAKE_CXX_STANDARD 11) <span class="pl-k">add_library</span>(MySharedLib SHARED library.cpp library.h)</pre></div> <p dir="auto">library.h</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#ifndef MYSHAREDLIB_LIBRARY_H #define MYSHAREDLIB_LIBRARY_H // print Hello World! void hello(); // Sum using variable template parameters template <typename T> T sum(T t) { return t; } template <typename T, typename ...Types> T sum(T first, Types ... rest) { return first + sum<T>(rest...); } #endif"><pre>#<span class="pl-k">ifndef</span> MYSHAREDLIB_LIBRARY_H #<span class="pl-k">define</span> <span class="pl-en">MYSHAREDLIB_LIBRARY_H</span> <span class="pl-c"><span class="pl-c">//</span> print Hello World!</span> <span class="pl-k">void</span> <span class="pl-en">hello</span>(); <span class="pl-c"><span class="pl-c">//</span> Sum using variable template parameters</span> <span class="pl-k">template </span><<span class="pl-k">typename</span> T> T <span class="pl-en">sum</span>(T t) { <span class="pl-k">return</span> t; } <span class="pl-k">template </span><<span class="pl-k">typename</span> T, <span class="pl-k">typename</span> ...Types> T <span class="pl-en">sum</span>(T first, Types ... rest) { <span class="pl-k">return</span> first + sum<T>(rest...); } #<span class="pl-k">endif</span></pre></div> <p dir="auto">library.cpp</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include <iostream> #include "library.h" void hello() { std::cout << "Hello, World!" << std::endl; }"><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">"</span>library.h<span class="pl-pds">"</span></span> <span class="pl-k">void</span> <span class="pl-en">hello</span>() { std::cout << <span class="pl-s"><span class="pl-pds">"</span>Hello, World!<span class="pl-pds">"</span></span> << std::endl; }</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">use of so shared library (called by executable project)</h4><a id="user-content-use-of-so-shared-library-called-by-executable-project" class="anchor" aria-label="Permalink: use of so shared library (called by executable project)" href="#use-of-so-shared-library-called-by-executable-project"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Use CLion to call a shared library</p> <p dir="auto">Create an executable project named TestSharedLib</p> <p dir="auto">CMakeLists.txt</p> <div class="highlight highlight-source-cmake notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cmake_minimum_required (VERSION 3.10) project (TestSharedLib) # C ++ 11 compile set (CMAKE_CXX_STANDARD 11) # Header file path set (INC_DIR / home / xx / code / clion / MySharedLib) # Library file path set (LIB_DIR / home / xx / code / clion / MySharedLib / cmake-build-debug) include_directories(${INC_DIR}) link_directories(${LIB_DIR}) link_libraries(MySharedLib) add_executable(TestSharedLib main.cpp) # link MySharedLib Library target_link_libraries(TestSharedLib MySharedLib)"><pre><span class="pl-k">cmake_minimum_required</span> (<span class="pl-e">VERSION</span> 3.10) <span class="pl-k">project</span> (TestSharedLib) <span class="pl-c"># C ++ 11 compile</span> <span class="pl-k">set</span> (CMAKE_CXX_STANDARD 11) <span class="pl-c"># Header file path</span> <span class="pl-k">set</span> (INC_DIR / home / xx / code / clion / MySharedLib) <span class="pl-c"># Library file path</span> <span class="pl-k">set</span> (LIB_DIR / home / xx / code / clion / MySharedLib / cmake-<span class="pl-e">build</span>-debug) <span class="pl-k">include_directories</span>(<span class="pl-k">${INC_DIR}</span>) <span class="pl-k">link_directories</span>(<span class="pl-k">${LIB_DIR}</span>) <span class="pl-k">link_libraries</span>(MySharedLib) <span class="pl-k">add_executable</span>(TestSharedLib main.cpp) <span class="pl-c"># link MySharedLib Library</span> <span class="pl-k">target_link_libraries</span>(TestSharedLib MySharedLib)</pre></div> <p dir="auto">main.cpp</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#include <iostream> #include "library.h" using std::cout; using std::endl; int main() { hello(); cout << "1 + 2 = " << sum(1,2) << endl; cout << "1 + 2 + 3 = " << sum(1,2,3) << endl; return 0; }"><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">"</span>library.h<span class="pl-pds">"</span></span> <span class="pl-k">using</span> std::cout; <span class="pl-k">using</span> std::endl; <span class="pl-k">int</span> <span class="pl-en">main</span>() { <span class="pl-c1">hello</span>(); cout << <span class="pl-s"><span class="pl-pds">"</span>1 + 2 = <span class="pl-pds">"</span></span> << <span class="pl-c1">sum</span>(<span class="pl-c1">1</span>,<span class="pl-c1">2</span>) << endl; cout << <span class="pl-s"><span class="pl-pds">"</span>1 + 2 + 3 = <span class="pl-pds">"</span></span> << <span class="pl-c1">sum</span>(<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>) << endl; <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <p dir="auto">Results</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Hello, World! 1 + 2 = 3 1 + 2 + 3 = 6"><pre class="notranslate"><code>Hello, World! 1 + 2 = 3 1 + 2 + 3 = 6 </code></pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Windows Application entry function</h3><a id="user-content-windows-application-entry-function" class="anchor" aria-label="Permalink: Windows Application entry function" href="#windows-application-entry-function"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>GUI(Graphical User Interface) application, linker options:<code>/SUBSYSTEM:WINDOWS</code></li> <li>CUI(Console User Interface) application, linker options:<code>/SUBSYSTEM:CONSOLE</code></li> </ul> <p dir="auto">_tWinMain versus _tmain Function declaration</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Int WINAPI _tWinMain( HINSTANCE hInstanceExe, HINSTANCE, PTSTR pszCmdLine, int nCmdShow); int _tmain( int argc, TCHAR *argv[], TCHAR *envp[]);"><pre>Int WINAPI <span class="pl-en">_tWinMain</span>( HINSTANCE hInstanceExe, HINSTANCE, PTSTR pszCmdLine, <span class="pl-k">int</span> nCmdShow); <span class="pl-k">int</span> <span class="pl-en">_tmain</span>( <span class="pl-k">int</span> argc, TCHAR *argv[], TCHAR *envp[]);</pre></div> <markdown-accessiblity-table><table> <thead> <tr> <th>Application Type</th> <th>Entry Point Function</th> <th>Embedded Startup Function</th> </tr> </thead> <tbody> <tr> <td>GUI application for processing ANSI characters (strings)</td> <td>_tWinMain (WinMain)</td> <td>WinMainCRTSartup</td> </tr> <tr> <td>GUI application for handling Unicode characters (strings)</td> <td>_tWinMain (wWinMain)</td> <td>wWinMainCRTSartup</td> </tr> <tr> <td>CUI application that handles ANSI characters (strings)</td> <td>_tmain (Main)</td> <td>mainCRTSartup</td> </tr> <tr> <td>CUI application for handling Unicode characters (strings)</td> <td>_tmain (wMain)</td> <td>wmainCRTSartup</td> </tr> <tr> <td>Dynamic-Link Library</td> <td>DllMain</td> <td>_DllMainCRTStartup</td> </tr> </tbody> </table></markdown-accessiblity-table> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Dynamic-Link Library for Windows</h3><a id="user-content-dynamic-link-library-for-windows" class="anchor" aria-label="Permalink: Dynamic-Link Library for Windows" href="#dynamic-link-library-for-windows"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">Part of the knowledge comes from "Windows Core Programming (Fifth Edition)"</p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Uses</h4><a id="user-content-uses" class="anchor" aria-label="Permalink: Uses" href="#uses"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Expanded application features</li> <li>Simplified project management</li> <li>Helps save memory</li> <li>Promote the sharing of resources</li> <li>Improved localization</li> <li>Helps resolve differences between platforms</li> <li>Can be used for special purposes</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Note</h4><a id="user-content-note" class="anchor" aria-label="Permalink: Note" href="#note"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>Creating a DLL is actually creating a function that can be called by an executable module</li> <li>When a module provides a memory allocation function (malloc, new), it must also provide another memory release function (free, delete)</li> <li>When mixing C and C++, use the extern "C" modifier</li> <li>A DLL can export functions, variables (to avoid export), C++ classes (export and import need to be the same as the compiler, otherwise avoid export)</li> <li>DLL module: __declspec (dllexport) in the cpp file is written before the include header file</li> <li>Calling DLL's executable module: __declspec (dllimport) of the cpp file should not define MYLIBAPI before</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Search order for loading Windows programs</h4><a id="user-content-search-order-for-loading-windows-programs" class="anchor" aria-label="Permalink: Search order for loading Windows programs" href="#search-order-for-loading-windows-programs"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>Directory containing executable files</li> <li>The system directory of Windows can be obtained through GetSystemDirectory</li> <li>16-bit system directory, the System subdirectory in the Windows directory</li> <li>The Windows directory can be obtained through GetWindowsDirectory</li> <li>The current directory of the process</li> <li>Directories listed in the PATH environment variable</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">DLL Entry function</h4><a id="user-content-dll-entry-function" class="anchor" aria-label="Permalink: DLL Entry function" href="#dll-entry-function"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">DllMain function</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch(fdwReason) { case DLL_PROCESS_ATTACH: // Called when mapping a DLL to the process address space for the first time // The DLL is being mapped into the process' address space. break; case DLL_THREAD_ATTACH: // When the process creates a thread, it is used to tell the DLL to perform thread-related initialization (non-main thread execution) // A thread is bing created. break; case DLL_THREAD_DETACH: // The system calls ExitThread before the thread exits, the thread that is about to be terminated performs thread-related cleanup by telling the DLL // A thread is exiting cleanly. break; case DLL_PROCESS_DETACH: // Called when a DLL is removed from the process's address space // The DLL is being unmapped from the process' address space. break; } return (TRUE); // Used only for DLL_PROCESS_ATTACH }"><pre>BOOL WINAPI <span class="pl-en">DllMain</span>(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { <span class="pl-k">switch</span>(fdwReason) { <span class="pl-k">case</span> DLL_PROCESS_ATTACH: <span class="pl-c"><span class="pl-c">//</span> Called when mapping a DLL to the process address space for the first time</span> <span class="pl-c"><span class="pl-c">//</span> The DLL is being mapped into the process' address space.</span> <span class="pl-k">break</span>; <span class="pl-k">case</span> DLL_THREAD_ATTACH: <span class="pl-c"><span class="pl-c">//</span> When the process creates a thread, it is used to tell the DLL to perform thread-related initialization (non-main thread execution)</span> <span class="pl-c"><span class="pl-c">//</span> A thread is bing created.</span> <span class="pl-k">break</span>; <span class="pl-k">case</span> DLL_THREAD_DETACH: <span class="pl-c"><span class="pl-c">//</span> The system calls ExitThread before the thread exits, the thread that is about to be terminated performs thread-related cleanup by telling the DLL</span> <span class="pl-c"><span class="pl-c">//</span> A thread is exiting cleanly.</span> <span class="pl-k">break</span>; <span class="pl-k">case</span> DLL_PROCESS_DETACH: <span class="pl-c"><span class="pl-c">//</span> Called when a DLL is removed from the process's address space</span> <span class="pl-c"><span class="pl-c">//</span> The DLL is being unmapped from the process' address space.</span> <span class="pl-k">break</span>; } <span class="pl-k">return</span> (<span class="pl-c1">TRUE</span>); <span class="pl-c"><span class="pl-c">//</span> Used only for DLL_PROCESS_ATTACH</span> }</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Load and unload library</h4><a id="user-content-load-and-unload-library" class="anchor" aria-label="Permalink: Load and unload library" href="#load-and-unload-library"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">LoadLibrary、LoadLibraryExA、LoadPackagedLibrary、FreeLibrary、FreeLibraryAndExitThread Function declaration</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// load library HMODULE WINAPI LoadLibrary ( _In_ LPCTSTR lpFileName ); HMODULE LoadLibraryExA ( LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); // To load a Win32 DLL in a Universal Windows Platform (UWP) application, you need to call LoadPackagedLibrary instead of LoadLibrary or LoadLibraryEx HMODULE LoadPackagedLibrary ( LPCWSTR lpwLibFileName, DWORD Reserved ); // uninstall library BOOL WINAPI FreeLibrary ( _In_ HMODULE hModule ); // Unload the library and exit the thread VOID WINAPI FreeLibraryAndExitThread( _In_ HMODULE hModule, _In_ DWORD dwExitCode );"><pre><span class="pl-c"><span class="pl-c">//</span> load library</span> HMODULE WINAPI <span class="pl-en">LoadLibrary</span> ( _In_ LPCTSTR lpFileName ); HMODULE <span class="pl-en">LoadLibraryExA</span> ( LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); <span class="pl-c"><span class="pl-c">//</span> To load a Win32 DLL in a Universal Windows Platform (UWP) application, you need to call LoadPackagedLibrary instead of LoadLibrary or LoadLibraryEx</span> HMODULE <span class="pl-en">LoadPackagedLibrary</span> ( LPCWSTR lpwLibFileName, DWORD Reserved ); <span class="pl-c"><span class="pl-c">//</span> uninstall library</span> BOOL WINAPI <span class="pl-en">FreeLibrary</span> ( _In_ HMODULE hModule ); <span class="pl-c"><span class="pl-c">//</span> Unload the library and exit the thread</span> VOID WINAPI <span class="pl-en">FreeLibraryAndExitThread</span>( _In_ HMODULE hModule, _In_ DWORD dwExitCode );</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Display link to export symbol</h4><a id="user-content-display-link-to-export-symbol" class="anchor" aria-label="Permalink: Display link to export symbol" href="#display-link-to-export-symbol"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">GetProcAddress function declaration</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="FARPROC GetProcAddress ( HMODULE hInstDll, PCSTR pszSymbolName // Can only accept ANSI strings, not Unicode );"><pre>FARPROC <span class="pl-en">GetProcAddress</span> ( HMODULE hInstDll, PCSTR pszSymbolName <span class="pl-c"><span class="pl-c">//</span> Can only accept ANSI strings, not Unicode</span> );</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">DumpBin.exe View DLL information</h4><a id="user-content-dumpbinexe-view-dll-information" class="anchor" aria-label="Permalink: DumpBin.exe View DLL information" href="#dumpbinexe-view-dll-information"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Use <code>DumpBin.exe</code> in the<code> VS Developer Command Prompt</code> to view the exported section of the DLL library (exported variables, functions, symbols of class names), relative virtual addresses (RVA). Such as:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DUMPBIN -exports D: \ mydll.dll"><pre class="notranslate"><code>DUMPBIN -exports D: \ mydll.dll </code></pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Flow chart of LoadLibrary and FreeLibrary</h4><a id="user-content-flow-chart-of-loadlibrary-and-freelibrary" class="anchor" aria-label="Permalink: Flow chart of LoadLibrary and FreeLibrary" href="#flow-chart-of-loadlibrary-and-freelibrary"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">LoadLibrary and FreeLibrary flowchart</p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">LoadLibrary</h5><a id="user-content-loadlibrary" class="anchor" aria-label="Permalink: LoadLibrary" href="#loadlibrary"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/WindowsLoadLibrary.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/WindowsLoadLibrary.png" alt="WindowsLoadLibrary" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h5 tabindex="-1" class="heading-element" dir="auto">FreeLibrary</h5><a id="user-content-freelibrary" class="anchor" aria-label="Permalink: FreeLibrary" href="#freelibrary"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://raw.githubusercontent.com/huihut/interview/master/images/WindowsFreeLibrary.png"><img src="https://raw.githubusercontent.com/huihut/interview/master/images/WindowsFreeLibrary.png" alt="WindowsFreeLibrary" style="max-width: 100%;"></a></p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Writing of DLL library (export a DLL module)</h4><a id="user-content-writing-of-dll-library-export-a-dll-module" class="anchor" aria-label="Permalink: Writing of DLL library (export a DLL module)" href="#writing-of-dll-library-export-a-dll-module"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Writing DLL library (export a DLL module) DLL header file</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// MyLib.h #ifdef MYLIBAPI // MYLIBAPI should be defined before include "Mylib.h" in all DLL source files // All functions / variables are being exported #else // This header file is included by an exe source code module, which means that all functions / variables are imported #define MYLIBAPI extern "C" __declspec (dllimport) #endif // Define any data structure and symbol here // Define exported variables (avoid exporting variables) MYLIBAPI int g_nResult; // Define the prototype of the exported function MYLIBAPI int Add(int nLeft, int nRight);"><pre><span class="pl-c"><span class="pl-c">//</span> MyLib.h</span> #<span class="pl-k">ifdef</span> MYLIBAPI <span class="pl-c"><span class="pl-c">//</span> MYLIBAPI should be defined before include "Mylib.h" in all DLL source files</span> <span class="pl-c"><span class="pl-c">//</span> All functions / variables are being exported</span> #<span class="pl-k">else</span> <span class="pl-c"><span class="pl-c">//</span> This header file is included by an exe source code module, which means that all functions / variables are imported</span> #<span class="pl-k">define</span> <span class="pl-en">MYLIBAPI</span> <span class="pl-k">extern</span> <span class="pl-s"><span class="pl-pds">"</span>C<span class="pl-pds">"</span></span> __declspec (dllimport) #<span class="pl-k">endif</span> <span class="pl-c"><span class="pl-c">//</span> Define any data structure and symbol here</span> <span class="pl-c"><span class="pl-c">//</span> Define exported variables (avoid exporting variables)</span> MYLIBAPI <span class="pl-k">int</span> g_nResult; <span class="pl-c"><span class="pl-c">//</span> Define the prototype of the exported function</span> MYLIBAPI <span class="pl-k">int</span> <span class="pl-en">Add</span>(<span class="pl-k">int</span> nLeft, <span class="pl-k">int</span> nRight);</pre></div> <p dir="auto">DLL source files</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// MyLibFile1.cpp // Contains standard Windows and C runtime header files #include <windows.h> // Functions and variables exported from DLL source files #define MYLIBAPI extern "C" __declspec (dllexport) // Contains exported data structures, symbols, functions, variables #include "MyLib.h" // Put the code of this DLL source code file here int g_nResult; int Add(int nLeft, int nRight) { g_nResult = nLeft + nRight; return g_nResult; }"><pre><span class="pl-c"><span class="pl-c">//</span> MyLibFile1.cpp</span> <span class="pl-c"><span class="pl-c">//</span> Contains standard Windows and C runtime header files</span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>windows.h<span class="pl-pds">></span></span> <span class="pl-c"><span class="pl-c">//</span> Functions and variables exported from DLL source files</span> #<span class="pl-k">define</span> <span class="pl-en">MYLIBAPI</span> <span class="pl-k">extern</span> <span class="pl-s"><span class="pl-pds">"</span>C<span class="pl-pds">"</span></span> __declspec (dllexport) <span class="pl-c"><span class="pl-c">//</span> Contains exported data structures, symbols, functions, variables</span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">"</span>MyLib.h<span class="pl-pds">"</span></span> <span class="pl-c"><span class="pl-c">//</span> Put the code of this DLL source code file here</span> <span class="pl-k">int</span> g_nResult; <span class="pl-k">int</span> <span class="pl-en">Add</span>(<span class="pl-k">int</span> nLeft, <span class="pl-k">int</span> nRight) { g_nResult = nLeft + nRight; <span class="pl-k">return</span> g_nResult; }</pre></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Use of DLL library (dynamic link DLL at runtime)</h4><a id="user-content-use-of-dll-library-dynamic-link-dll-at-runtime" class="anchor" aria-label="Permalink: Use of DLL library (dynamic link DLL at runtime)" href="#use-of-dll-library-dynamic-link-dll-at-runtime"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">Use of DLL libraries (dynamically linking DLLs at runtime)</p> <div class="highlight highlight-source-c++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// A simple program that uses LoadLibrary and // GetProcAddress to access myPuts from Myputs.dll. #include <windows.h> #include <stdio.h> typedef int (__cdecl *MYPROC)(LPWSTR); int main( void ) { HINSTANCE hinstLib; MYPROC ProcAdd; BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; // Get a handle to the DLL module. hinstLib = LoadLibrary(TEXT("MyPuts.dll")); // If the handle is valid, try to get the function address. if (hinstLib != NULL) { ProcAdd = (MYPROC) GetProcAddress(hinstLib, "myPuts"); // If the function address is valid, call the function. if (NULL != ProcAdd) { fRunTimeLinkSuccess = TRUE; (ProcAdd) (L"Message sent to the DLL function\n"); } // Free the DLL module. fFreeResult = FreeLibrary(hinstLib); } // If unable to call the DLL function, use an alternative. if (! fRunTimeLinkSuccess) printf("Message printed from executable\n"); return 0; }"><pre><span class="pl-c"><span class="pl-c">//</span> A simple program that uses LoadLibrary and </span> <span class="pl-c"><span class="pl-c">//</span> GetProcAddress to access myPuts from Myputs.dll. </span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>windows.h<span class="pl-pds">></span></span> #<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>stdio.h<span class="pl-pds">></span></span> <span class="pl-k">typedef</span> <span class="pl-en">int</span> (__cdecl *MYPROC)(LPWSTR); <span class="pl-k">int</span> <span class="pl-en">main</span>( <span class="pl-k">void</span> ) { HINSTANCE hinstLib; MYPROC ProcAdd; BOOL <span class="pl-smi">fFreeResult</span>, <span class="pl-smi">fRunTimeLinkSuccess</span> = <span class="pl-c1">FALSE</span>; <span class="pl-c"><span class="pl-c">//</span> Get a handle to the DLL module.</span> hinstLib = <span class="pl-c1">LoadLibrary</span>(<span class="pl-c1">TEXT</span>(<span class="pl-s"><span class="pl-pds">"</span>MyPuts.dll<span class="pl-pds">"</span></span>)); <span class="pl-c"><span class="pl-c">//</span> If the handle is valid, try to get the function address.</span> <span class="pl-k">if</span> (hinstLib != <span class="pl-c1">NULL</span>) { ProcAdd = (MYPROC) <span class="pl-c1">GetProcAddress</span>(hinstLib, <span class="pl-s"><span class="pl-pds">"</span>myPuts<span class="pl-pds">"</span></span>); <span class="pl-c"><span class="pl-c">//</span> If the function address is valid, call the function.</span> <span class="pl-k">if</span> (<span class="pl-c1">NULL</span> != ProcAdd) { <span class="pl-smi">fRunTimeLinkSuccess</span> = <span class="pl-c1">TRUE</span>; (ProcAdd) (<span class="pl-s"><span class="pl-pds">L"</span>Message sent to the DLL function<span class="pl-cce">\n</span><span class="pl-pds">"</span></span>); } <span class="pl-c"><span class="pl-c">//</span> Free the DLL module.</span> <span class="pl-smi">fFreeResult</span> = <span class="pl-c1">FreeLibrary</span>(hinstLib); } <span class="pl-c"><span class="pl-c">//</span> If unable to call the DLL function, use an alternative.</span> <span class="pl-k">if</span> (! <span class="pl-smi">fRunTimeLinkSuccess</span>) <span class="pl-c1">printf</span>(<span class="pl-s"><span class="pl-pds">"</span>Message printed from executable<span class="pl-cce">\n</span><span class="pl-pds">"</span></span>); <span class="pl-k">return</span> <span class="pl-c1">0</span>; }</pre></div> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Runtime(Runtime Library)</h3><a id="user-content-runtimeruntime-library" class="anchor" aria-label="Permalink: Runtime(Runtime Library)" href="#runtimeruntime-library"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">Typical program operation steps</h4><a id="user-content-typical-program-operation-steps" class="anchor" aria-label="Permalink: Typical program operation steps" href="#typical-program-operation-steps"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ol dir="auto"> <li>The operating system creates a process and passes control to the entry point of the program (often an entry function in the runtime library)</li> <li>The entry function initializes the runtime library and program running environment (including heap, I / O, threads, global variable construction, etc.).</li> <li>After the entry function is initialized, the main function is called to officially start executing the main part of the program.</li> <li>After the main function finishes executing, return to the entry function for cleanup (including global variable destruction, heap destruction, closing I / O, etc.), and then make a system call to end the process.</li> </ol> <blockquote> <p dir="auto">I / O of a program refers to the interaction between the program and the outside world, including files, management programs, network, command line, signals, etc. More broadly, I / O refers to what the operating system understands as a "file."</p> </blockquote> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">glibc entry</h4><a id="user-content-glibc-entry" class="anchor" aria-label="Permalink: glibc entry" href="#glibc-entry"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><code>_start-> __libc_start_main-> exit-> _exit</code></p> <p dir="auto">The <code>main (argc, argv, __environ)</code> function is executed in <code>__libc_start_main</code>.</p> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">MSVC CRT Entry</h4><a id="user-content-msvc-crt-entry" class="anchor" aria-label="Permalink: MSVC CRT Entry" href="#msvc-crt-entry"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><code>int mainCRTStartup (void)</code></p> <p dir="auto">Do the following:</p> <ol dir="auto"> <li>Initialize global variables related to the OS version.</li> <li>Initialize the heap.</li> <li>Initialize I / O.</li> <li>Get command line parameters and environment variables.</li> <li>Initialize some data of the C library.</li> <li>Call main and record the return value.</li> <li>Check for errors and return the return value of main.</li> </ol> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">C Language Runtime (CRT)</h4><a id="user-content-c-language-runtime-crt" class="anchor" aria-label="Permalink: C Language Runtime (CRT)" href="#c-language-runtime-crt"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">It contains the following functions:</p> <ul dir="auto"> <li>Start and exit: including entry functions and other functions on which entry functions depend.</li> <li>Standard functions: There are functions implemented by the C language standard library specified by the C language standard.</li> <li>I/O: Encapsulation and implementation of I / O functions.</li> <li>Heap: Encapsulation and implementation of the heap.</li> <li>Language implementation: implementation of some special functions in the language.</li> <li>Debugging: Code that implements debugging functions.</li> </ul> <div class="markdown-heading" dir="auto"><h4 tabindex="-1" class="heading-element" dir="auto">C Language Standard Library (ANSI C)</h4><a id="user-content-c-language-standard-library-ansi-c" class="anchor" aria-label="Permalink: C Language Standard Library (ANSI C)" href="#c-language-standard-library-ansi-c"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">contain:</p> <ul dir="auto"> <li>Standard input and output (stdio.h)</li> <li>File operations (stdio.h)</li> <li>Character manipulation (ctype.h)</li> <li>String operations (string.h)</li> <li>Mathematical functions (math.h)</li> <li>Resource Management (stdlib.h)</li> <li>Format conversion (stdlib.h)</li> <li>Time / Date (time.h)</li> <li>Assertions (assert.h)</li> <li>Constants on various types (limits.h & float.h)</li> <li>Variable length parameter (stdarg.h)</li> <li>Non-local jump (setjmp.h)</li> </ul> <p dir="auto"><a id="user-content-books"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">📚 Books</h2><a id="user-content--books" class="anchor" aria-label="Permalink: 📚 Books" href="#-books"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto"><a href="https://github.com/huihut/CS-Books">huihut/CS-Books</a>:📚 Computer Technology Books PDF</p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Language</h3><a id="user-content-language" class="anchor" aria-label="Permalink: Language" href="#language"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>"C ++ Primer"</li> <li>"Effective C ++"</li> <li>"More Effective C ++"</li> <li>"Exploring the C ++ Object Model"</li> <li>"Understanding C ++ 11"</li> <li>"Anatomy of STL Source Code"</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Algorithm</h3><a id="user-content-algorithm-1" class="anchor" aria-label="Permalink: Algorithm" href="#algorithm-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>"Sword Finger Offer"</li> <li>"Programming Pearls"</li> <li>"Programmer Interview Collection"</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">System</h3><a id="user-content-system" class="anchor" aria-label="Permalink: System" href="#system"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>"Understanding Computer Systems"</li> <li>"Windows Core Programming"</li> <li>"Advanced Programming in the Unix Environment"</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">The internet</h3><a id="user-content-the-internet" class="anchor" aria-label="Permalink: The internet" href="#the-internet"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>"Unix Network Programming"</li> <li>"Detailed Explanation of TCP / IP"</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Other</h3><a id="user-content-other-1" class="anchor" aria-label="Permalink: Other" href="#other-1"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li>"The Self-Cultivation of Programmers"</li> </ul> <p dir="auto"><a id="user-content-cc-development-direction"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">🔱 C / C ++ Development Direction</h2><a id="user-content--c--c--development-direction" class="anchor" aria-label="Permalink: 🔱 C / C ++ Development Direction" href="#-c--c--development-direction"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <blockquote> <p dir="auto">The development direction of C / C ++ is very wide, including not limited to the following directions. The following are some of the requirements for recruiting positions of big factories and schools.</p> </blockquote> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Backend / Server</h3><a id="user-content-backend--server" class="anchor" aria-label="Permalink: Backend / Server" href="#backend--server"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[Backend Development]</p> <ul dir="auto"> <li>Solid basic programming skills, master C / C ++ / JAVA and other development languages, commonly used algorithms and data structures;</li> <li>Familiar with TCP / UDP network protocol and related programming, inter-process communication programming;</li> <li>Understanding Python, Shell, Perl and other scripting languages;</li> <li>Understand MYSQL, SQL language, programming, NoSQL, key-value storage principle;</li> <li>Comprehensive and solid software knowledge structure, mastering professional knowledge of operating systems, software engineering, design patterns, data structures, database systems, and network security;</li> <li>Understand the knowledge of distributed system design and development, load balancing technology, system disaster recovery design, and high availability systems.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Desktop Client</h3><a id="user-content-desktop-client" class="anchor" aria-label="Permalink: Desktop Client" href="#desktop-client"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[PC client development]</p> <ul dir="auto"> <li>Bachelor degree or above in computer software, majoring in programming, solid foundation, understanding of algorithms and data structure;</li> <li>Familiar with memory management, file system, process thread scheduling of windows operating system;</li> <li>Familiar with MFC / windows interface implementation mechanism, proficient in VC, proficient in C / C ++, proficient in STL, and network programming experience under Windows;</li> <li>Familiar with Windows client development and debugging, Windows application software development experience is preferred;</li> <li>Passionate about innovation and solving challenging problems, with good algorithm foundation and system analysis ability.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Graphics / Game / VR / AR</h3><a id="user-content-graphics--game--vr--ar" class="anchor" aria-label="Permalink: Graphics / Game / VR / AR" href="#graphics--game--vr--ar"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[Game Client Development]</p> <ul dir="auto"> <li>Bachelor degree or above in computer science / engineering major, passion for programming, solid foundation, understanding of algorithms, data structure, software design related knowledge;</li> <li>At least one programming language commonly used in game development, C ++ / C # programming experience is preferred;</li> <li>Experience with game engines (such as Unity, Unreal) is preferred;</li> <li>Knowledge of game client technology (such as graphics, audio, animation, physics, artificial intelligence, network synchronization) is preferred;</li> <li>Passionate about innovation and solving challenging problems, strong learning ability, analytical and problem solving skills, and a good sense of teamwork;</li> <li>Ability to read English technical documents;</li> <li>Love games.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Test Development</h3><a id="user-content-test-development" class="anchor" aria-label="Permalink: Test Development" href="#test-development"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[Test Development]</p> <ul dir="auto"> <li>Bachelor degree or above in computer or related field;</li> <li>One to two years of programming experience in C / C ++ / Python or other computer languages;</li> <li>Ability to write test plans, test cases, and achieve performance and safety tests;</li> <li>Ability to implement automated systems;</li> <li>Ability to locate and investigate product defects and code-level debugging defects;</li> <li>Work proactively, have a sense of responsibility, and have a good team spirit.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Cyber Security / Reverse</h3><a id="user-content-cyber-security--reverse" class="anchor" aria-label="Permalink: Cyber Security / Reverse" href="#cyber-security--reverse"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[safety technology]</p> <ul dir="auto"> <li>Love the Internet, have a passionate pursuit of operating systems and network security, and professionalism is not limited;</li> <li>Familiar with vulnerability mining, network security attack and defense technologies, and common hacking techniques;</li> <li>Master basic development skills and be proficient in C / C ++ language;</li> <li>Have a good grasp of database, operating system and network principles;</li> <li>Experience in software reverse, network security attack and defense or security system development is preferred.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Embedded / IoT</h3><a id="user-content-embedded--iot" class="anchor" aria-label="Permalink: Embedded / IoT" href="#embedded--iot"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[Embedded Application Development]</p> <ul dir="auto"> <li>Have a good programming foundation, proficient in C / C ++ language;</li> <li>Master the necessary knowledge for software development such as operating system and data structure;</li> <li>Strong communication and understanding ability and good teamwork awareness;</li> <li>Development experience on Linux / Android system platform is preferred.</li> </ul> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Audio / Video / Streaming / SDK</h3><a id="user-content-audio--video--streaming--sdk" class="anchor" aria-label="Permalink: Audio / Video / Streaming / SDK" href="#audio--video--streaming--sdk"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[Audio and video codec]</p> <ol dir="auto"> <li>Master's degree or above, computer, signal processing, mathematics, information and related majors and directions;</li> <li>Solid video coding and decoding foundation, familiar with commonly used HEVC or H264, have a good digital signal processing foundation;</li> <li>Master C / C ++, strong code ability, familiar with an assembly language is preferred;</li> <li>Strong English literature reading ability;</li> <li>Strong learning ability, teamwork spirit, and strong resistance to stress.</li> </ol> <div class="markdown-heading" dir="auto"><h3 tabindex="-1" class="heading-element" dir="auto">Computer Vision / Machine Learning</h3><a id="user-content-computer-vision--machine-learning" class="anchor" aria-label="Permalink: Computer Vision / Machine Learning" href="#computer-vision--machine-learning"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">[Computer Vision Research]</p> <ul dir="auto"> <li>Computer, applied mathematics, pattern recognition, artificial intelligence, automatic control, statistics, operations research, bioinformatics, physics / quantum computing, neuroscience, sociology / psychology and other majors, image processing, pattern recognition, machine learning related research Direction, undergraduate and above, doctoral degree is preferred;</li> <li>Proficient in basic algorithms and applications related to computer vision and image processing;</li> <li>Strong algorithm implementation ability, proficient in C / C ++ programming, familiar with at least one programming language of Shell / Python / Matlab;</li> <li>Publication of papers in computer vision, pattern recognition and other academic conferences or journals, awards in relevant international competitions, and related patents are preferred.</li> </ul> <p dir="auto"><a id="user-content-review-of-brush-questions-website"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">💯 Review brush question website</h2><a id="user-content--review-brush-question-website" class="anchor" aria-label="Permalink: 💯 Review brush question website" href="#-review-brush-question-website"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="http://www.cplusplus.com/" rel="nofollow">cplusplus</a></li> <li><a href="https://zh.cppreference.com/w/%E9%A6%96%E9%A1%B5" rel="nofollow">cppreference</a></li> <li><a href="http://www.runoob.com/cplusplus/cpp-tutorial.html" rel="nofollow">runoob</a></li> <li><a href="https://leetcode.com/" rel="nofollow">leetcode</a> | <a href="https://leetcode-cn.com/" rel="nofollow">leetcode-cn</a></li> <li><a href="https://www.lintcode.com/" rel="nofollow">lintcode</a></li> <li><a href="https://www.nowcoder.net/" rel="nofollow">nowcoder</a></li> </ul> <p dir="auto"><a id="user-content-interview-questions-experience"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">📝 Interview Question Experience</h2><a id="user-content--interview-question-experience" class="anchor" aria-label="Permalink: 📝 Interview Question Experience" href="#-interview-question-experience"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="https://www.nowcoder.com/discuss/205497" rel="nofollow">Nowcoder.com's summary of the 2020 autumn tricks! (Post division)</a></li> <li><a href="https://www.nowcoder.com/discuss/197116" rel="nofollow">【Preparation for Autumn Moves】 Raiders for 2020 Autumn Moves</a></li> <li><a href="https://www.nowcoder.com/discuss/90907" rel="nofollow">2019 School Recruitment Summary! 【Daily Update】</a></li> <li><a href="https://www.nowcoder.com/discuss/146655" rel="nofollow">2019 School Recruitment Technology Posts Summary [Technology]</a></li> <li><a href="https://www.nowcoder.com/discuss/68802" rel="nofollow">2018 School Recruitment Questions Summary</a></li> <li><a href="https://www.nowcoder.com/discuss/12805" rel="nofollow">2017 Autumn Campus Recruitment Pen and Face Summaries</a></li> <li><a href="https://www.nowcoder.com/discuss/25268" rel="nofollow">The most complete collection of 2017 spring tricks in history!!</a></li> <li><a href="https://www.nowcoder.com/discuss/57978" rel="nofollow">Interview questions are here</a></li> <li><a href="https://www.zhihu.com/question/29693016" rel="nofollow">zhihu. On the Internet job search, what well-written and attentive face have you seen? It is best to share your own facial and mental journey. </a></li> <li><a href="https://www.zhihu.com/question/24964987" rel="nofollow">zhihu. What are the most common interview algorithm questions for internet companies? </a></li> <li><a href="http://blog.csdn.net/ljzcome/article/details/574158" rel="nofollow">CSDN. C ++ Interview Questions Completely Organized</a></li> <li><a href="http://blog.csdn.net/Xiongchao99/article/details/74524807?locationNum=6&fps=1" rel="nofollow">CSDN. Baidu R & D interview questions (C ++ direction)</a></li> <li><a href="http://blog.csdn.net/fakine/article/details/51321544" rel="nofollow">CSDN. C ++ 30 common interview questions</a></li> <li><a href="http://blog.csdn.net/onever_say_love/article/details/51223886" rel="nofollow">CSDN. Tencent 2016 intern interview experience (already got offer)</a></li> <li><a href="https://www.cnblogs.com/Y1Focus/p/6707121.html" rel="nofollow">cnblogs. C ++ Interview Collection (Questions Asked for Interview)</a></li> <li><a href="https://www.cnblogs.com/fangyukuan/archive/2010/09/18/1829871.html" rel="nofollow">cnblogs. C / C ++ written and interview questions summary</a></li> <li><a href="https://www.cnblogs.com/LUO77/p/5771237.html" rel="nofollow">cnblogs. Summary of common C ++ interview questions and basic knowledge points (1)</a></li> <li><a href="https://segmentfault.com/a/1190000003745529" rel="nofollow">segmentfault. Summary of common interview questions in C ++</a></li> </ul> <p dir="auto"><a id="user-content-recruitment-time-post"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">📆 Recruiting time posts</h2><a id="user-content--recruiting-time-posts" class="anchor" aria-label="Permalink: 📆 Recruiting time posts" href="#-recruiting-time-posts"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="https://www.nowcoder.com/school/schedule" rel="nofollow">nowcoder . Enterprise Recruitment Schedule</a></li> </ul> <p dir="auto"><a id="user-content-recommend"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">👍 Recommend</h2><a id="user-content--recommend" class="anchor" aria-label="Permalink: 👍 Recommend" href="#-recommend"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <ul dir="auto"> <li><a href="https://github.com/CyC2018/Job-Recommend">Github. CyC2018 / Job-Recommend</a>: 🔎 Internet internal push information (social recruitment, school recruitment, internship)</li> <li><a href="https://github.com/amusi/AI-Job-Recommend">Github. Amusi / AI-Job-Recommend</a>: direction of artificial intelligence of domestic companies (including machine learning, deep learning, computer vision and natural language processing) Job recruitment information (including full-time, internship and school recruitment)</li> </ul> <p dir="auto"><a id="user-content-contributor"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">👬 Contributor</h2><a id="user-content--contributor" class="anchor" aria-label="Permalink: 👬 Contributor" href="#-contributor"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto"><a href="https://github.com/huihut/interview/graphs/contributors"><img src="https://camo.githubusercontent.com/86658d4c823f5138371c2f0c206265ec7e70331d656208dac5315711fd3beb40/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f696e746572766965772f636f6e7472696275746f72732e7376673f627574746f6e3d66616c7365" data-canonical-src="https://opencollective.com/interview/contributors.svg?button=false" style="max-width: 100%;"></a></p> <p dir="auto"><a id="user-content-license"></a></p> <div class="markdown-heading" dir="auto"><h2 tabindex="-1" class="heading-element" dir="auto">📜 License</h2><a id="user-content--license" class="anchor" aria-label="Permalink: 📜 License" href="#-license"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a></div> <p dir="auto">This repository follows the CC BY-NC-SA 4.0 (signed-non-commercial use-shared in the same way) agreement, please indicate the source when reprinting, and should not be used for commercial purposes.</p> <p dir="auto"><a href="https://github.com/huihut/interview/blob/master/LICENSE"><img src="https://camo.githubusercontent.com/62be294f71c9a1885f9cd8f54aa8b8bd42d432fd14b5393a8b25bcd1f34daa42/68747470733a2f2f692e6372656174697665636f6d6d6f6e732e6f72672f6c2f62792d6e632d73612f342e302f38387833312e706e67" alt="CC BY-NC-SA 4.0" data-canonical-src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" style="max-width: 100%;"></a></p> </article></div><button hidden=""></button></section></div></div></div> <!-- --> <!-- --> </div></div></div><div class="Box-sc-g0xbh4-0"></div></div></div></div></div><div id="find-result-marks-container" class="Box-sc-g0xbh4-0 cCoXib"></div><button hidden="" data-testid="" data-hotkey-scope="read-only-cursor-text-area"></button><button hidden=""></button></div> <!-- --> <!-- --> <script type="application/json" id="__PRIMER_DATA_:R0:__">{"resolvedServerColorMode":"day"}</script></div> </react-app> </turbo-frame> </div> </turbo-frame> </main> </div> </div> <footer class="footer pt-8 pb-6 f6 color-fg-muted p-responsive" role="contentinfo" > <h2 class='sr-only'>Footer</h2> <div class="d-flex flex-justify-center flex-items-center flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap"> <div class="d-flex flex-items-center flex-shrink-0 mx-2"> <a aria-label="Homepage" title="GitHub" class="footer-octicon mr-2" href="https://github.com"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M12.5.75C6.146.75 1 5.896 1 12.25c0 5.089 3.292 9.387 7.863 10.91.575.101.79-.244.79-.546 0-.273-.014-1.178-.014-2.142-2.889.532-3.636-.704-3.866-1.35-.13-.331-.69-1.352-1.18-1.625-.402-.216-.977-.748-.014-.762.906-.014 1.553.834 1.769 1.179 1.035 1.74 2.688 1.25 3.349.948.1-.747.402-1.25.733-1.538-2.559-.287-5.232-1.279-5.232-5.678 0-1.25.445-2.285 1.178-3.09-.115-.288-.517-1.467.115-3.048 0 0 .963-.302 3.163 1.179.92-.259 1.897-.388 2.875-.388.977 0 1.955.13 2.875.388 2.2-1.495 3.162-1.179 3.162-1.179.633 1.581.23 2.76.115 3.048.733.805 1.179 1.825 1.179 3.09 0 4.413-2.688 5.39-5.247 5.678.417.36.776 1.05.776 2.128 0 1.538-.014 2.774-.014 3.162 0 .302.216.662.79.547C20.709 21.637 24 17.324 24 12.25 24 5.896 18.854.75 12.5.75Z"></path> </svg> </a> <span> © 2025 GitHub, Inc. </span> </div> <nav aria-label="Footer"> <h3 class="sr-only" id="sr-footer-heading">Footer navigation</h3> <ul class="list-style-none d-flex flex-justify-center flex-wrap mb-2 mb-lg-0" aria-labelledby="sr-footer-heading"> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to Terms","label":"text:terms"}" href="https://docs.github.com/site-policy/github-terms/github-terms-of-service" data-view-component="true" class="Link--secondary Link">Terms</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to privacy","label":"text:privacy"}" href="https://docs.github.com/site-policy/privacy-policies/github-privacy-statement" data-view-component="true" class="Link--secondary Link">Privacy</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to security","label":"text:security"}" href="https://github.com/security" data-view-component="true" class="Link--secondary Link">Security</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to status","label":"text:status"}" href="https://www.githubstatus.com/" data-view-component="true" class="Link--secondary Link">Status</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to docs","label":"text:docs"}" href="https://docs.github.com/" data-view-component="true" class="Link--secondary Link">Docs</a> </li> <li class="mx-2"> <a data-analytics-event="{"category":"Footer","action":"go to contact","label":"text:contact"}" href="https://support.github.com?tags=dotcom-footer" data-view-component="true" class="Link--secondary Link">Contact</a> </li> <li class="mx-2" > <cookie-consent-link> <button type="button" class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent" data-action="click:cookie-consent-link#showConsentManagement" data-analytics-event="{"location":"footer","action":"cookies","context":"subfooter","tag":"link","label":"cookies_link_subfooter_footer"}" > Manage cookies </button> </cookie-consent-link> </li> <li class="mx-2"> <cookie-consent-link> <button type="button" class="Link--secondary underline-on-hover border-0 p-0 color-bg-transparent" data-action="click:cookie-consent-link#showConsentManagement" data-analytics-event="{"location":"footer","action":"dont_share_info","context":"subfooter","tag":"link","label":"dont_share_info_link_subfooter_footer"}" > Do not share my personal information </button> </cookie-consent-link> </li> </ul> </nav> </div> </footer> <ghcc-consent id="ghcc" class="position-fixed bottom-0 left-0" style="z-index: 999999" data-initial-cookie-consent-allowed="" data-cookie-consent-required="false"></ghcc-consent> <div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path> </svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button> You can’t perform that action at this time. </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details> </template> <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div> </div> <template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path> </svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path> </svg> </clipboard-copy> </div> </template> <template id="snippet-clipboard-copy-button-unpositioned"> <div class="zeroclipboard-container"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path> </svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path> </svg> </clipboard-copy> </div> </template> </div> <div id="js-global-screen-reader-notice" class="sr-only mt-n1" aria-live="polite" aria-atomic="true" ></div> <div id="js-global-screen-reader-notice-assertive" class="sr-only mt-n1" aria-live="assertive" aria-atomic="true"></div> </body> </html>