{"id":10053,"date":"2023-11-06T22:13:50","date_gmt":"2023-11-06T22:13:50","guid":{"rendered":"https:\/\/adelnasim.com\/docs\/courses\/cpp-tutorial\/one-dimensional-array-part-3-passing-array-to-function\/"},"modified":"2024-04-07T01:19:35","modified_gmt":"2024-04-07T01:19:35","slug":"one-dimensional-array-part-3-passing-array-to-function","status":"publish","type":"docs","link":"https:\/\/adelnasim.com\/ar\/docs\/courses\/cpp-tutorial\/one-dimensional-array-part-3-passing-array-to-function\/","title":{"rendered":"\u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u062d\u0627\u062f\u064a\u0629 \u0627\u0644\u0628\u0639\u062f One Dimensional Array (3) - \u062a\u0645\u0631\u064a\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u062f\u0627\u0644\u0651\u0629"},"content":{"rendered":"<p>\u0641\u064a \u0644\u063a\u0629 C++\u060c \u064a\u0645\u0643\u0646\u0643 \u062a\u0645\u0631\u064a\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u062f\u0627\u0644\u0629\u060c \u0648\u0647\u0630\u0627 \u0645\u0641\u0647\u0648\u0645 \u0623\u0633\u0627\u0633\u064a \u0639\u0646\u062f \u0627\u0644\u0639\u0645\u0644 \u0645\u0639 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0627\u062a. \u0639\u0646\u062f\u0645\u0627 \u062a\u0642\u0648\u0645 \u0628\u062a\u0645\u0631\u064a\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u062f\u0627\u0644\u0629\u060c \u0641\u0625\u0646\u0643 \u062a\u0633\u0645\u062d \u0644\u0647\u0630\u0647 \u0627\u0644\u062f\u0627\u0644\u0629 \u0628\u0627\u0644\u0639\u0645\u0644 \u0639\u0644\u0649 \u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u0648 \u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0630\u0627 \u0644\u0632\u0645 \u0627\u0644\u0623\u0645\u0631.<\/p>\n<p>\u0641\u064a\u0645\u0627 \u064a\u0644\u064a \u0634\u0631\u062d \u0644\u0643\u064a\u0641\u064a\u0629 \u062a\u0645\u0631\u064a\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u062f\u0627\u0644\u0629 \u0641\u064a \u0644\u063a\u0629 C++:<\/p>\n<h2>\u0625\u0639\u0644\u0627\u0646 \u0645\u0635\u0641\u0648\u0641\u0629 \u0641\u064a \u062f\u0627\u0644\u0629<\/h2>\n<p>Parameters \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629: \u0644\u062a\u0645\u0631\u064a\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u062f\u0627\u0644\u0629\u060c \u064a\u062c\u0628 \u0639\u0644\u064a\u0643 \u0625\u0639\u0644\u0627\u0646 parameter \u0627\u0644\u062f\u0627\u0644\u0629 \u0643\u0645\u0635\u0641\u0648\u0641\u0629. \u064a\u0645\u0643\u0646\u0643 \u0625\u0639\u0644\u0627\u0646 \u0630\u0644\u0643 \u0628\u0637\u0631\u064a\u0642\u062a\u064a\u0646:<\/p>\n<ul>\n<li>\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062d\u062c\u0645 \u062b\u0627\u0628\u062a: \u0625\u0630\u0627 \u0643\u0646\u062a \u062a\u0639\u0631\u0641 \u062d\u062c\u0645 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0645\u0633\u0628\u0642\u064b\u0627\u060c \u0641\u064a\u0645\u0643\u0646\u0643 \u062a\u062d\u062f\u064a\u062f \u0627\u0644\u062d\u062c\u0645 \u0641\u064a parameter \u0627\u0644\u062f\u0627\u0644\u0629\u060c \u0643\u0645\u0627 \u064a\u0644\u064a:<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void functionName(int arr[5]) {\r\n    \/\/ Code to work with the array\r\n}<\/pre>\n<ul>\n<li>\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0645\u0624\u0634\u0631  Pointer: \u064a\u0645\u0643\u0646\u0643 \u0623\u064a\u0636\u064b\u0627 \u062a\u0639\u0631\u064a\u0641 parameter \u0627\u0644\u062f\u0627\u0644\u0629 \u0643\u0645\u0624\u0634\u0631 \u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u062f\u0648\u0646 \u062a\u062d\u062f\u064a\u062f \u0627\u0644\u062d\u062c\u0645\u060c \u0643\u0645\u0627 \u064a\u0644\u064a:<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void functionName(int *arr, int size) {\r\n    \/\/ Code to work with the array\r\n}<\/pre>\n<p>\u0641\u064a \u0647\u0630\u0647 \u0627\u0644\u062d\u0627\u0644\u0629\u060c \u064a\u0645\u0643\u0646\u0643 \u062a\u0645\u0631\u064a\u0631 \u062d\u062c\u0645 \u0645\u0635\u0641\u0648\u0641\u0629 \u0643\u0640argument \u0645\u0646\u0641\u0635\u0644\u0629.<\/p>\n<h2>\u062a\u0645\u0631\u064a\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u0627\u0644\u062f\u0627\u0644\u0629<\/h2>\n<p>\u0627\u0633\u062a\u062f\u0639\u0627\u0621 \u0627\u0644\u062f\u0627\u0644\u0629: \u0639\u0646\u062f \u0627\u0633\u062a\u062f\u0639\u0627\u0621 \u0627\u0644\u062f\u0627\u0644\u0629\u060c \u064a\u0645\u0643\u0646\u0643 \u062a\u0648\u0641\u064a\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0643\u0640argument. \u0625\u0630\u0627 \u0642\u0645\u062a \u0628\u062a\u0639\u0631\u064a\u0641 parameter  \u0627\u0644\u062f\u0627\u0644\u0629 \u0628\u062d\u062c\u0645 \u062b\u0627\u0628\u062a\u060c \u0641\u0633\u062a\u0642\u0648\u0645 \u0628\u062a\u0645\u0631\u064a\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0645\u0628\u0627\u0634\u0631\u0629. \u0625\u0630\u0627 \u0627\u0633\u062a\u062e\u062f\u0645\u062a \u0645\u0624\u0634\u0631\u064b\u0627\u060c \u0641\u0625\u0646\u0643 \u062a\u0642\u0648\u0645 \u0628\u062a\u0645\u0631\u064a\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0648\u062d\u062c\u0645\u0647\u0627 \u0643\u0640arguments.<\/p>\n<p>\u0645\u062b\u0627\u0644 \u0645\u0639 parameter \u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0630\u0627\u062a \u062d\u062c\u0645 \u062b\u0627\u0628\u062a:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">int myArray[5] = {1, 2, 3, 4, 5};\r\nfunctionName(myArray);<\/pre>\n<p>Example with a pointer parameter:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">int myArray[5] = {1, 2, 3, 4, 5};\r\nfunctionName(myArray, 5);\r\n<\/pre>\n<h2>\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0641\u064a \u0627\u0644\u062f\u0627\u0644\u0629<\/h2>\n<p>\u0627\u0644\u0639\u0645\u0644 \u0645\u0639 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629: \u062f\u0627\u062e\u0644 \u0627\u0644\u062f\u0627\u0644\u0629\u060c \u064a\u0645\u0643\u0646\u0643 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0648\u0645\u0639\u0627\u0644\u062c\u062a\u0647\u0627 \u062d\u0633\u0628 \u0627\u0644\u062d\u0627\u062c\u0629. \u064a\u0645\u0643\u0646\u0643 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0645\u0624\u0634\u0631\u0627\u062a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0627\u062a (\u0639\u0644\u0649 \u0633\u0628\u064a\u0644 \u0627\u0644\u0645\u062b\u0627\u0644\u060c arr[0]\u060c arr[1]) \u0644\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0641\u0631\u062f\u064a\u0629\u060c \u0648\u064a\u0645\u0643\u0646\u0643 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u062d\u0644\u0642\u0627\u062a \u0644\u0644\u062a\u0643\u0631\u0627\u0631 \u0639\u0628\u0631 \u0627\u0644\u0639\u0646\u0627\u0635\u0631.<\/p>\n<p>\u0645\u062b\u0627\u0644 \u0644\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void functionName(int arr[5]) {\r\n    for (int i = 0; i &lt; 5; i++) {\r\n        \/\/ Access and manipulate arr[i]\r\n    }\r\n}<\/pre>\n<p>\u0641\u064a\u0645\u0627 \u064a\u0644\u064a \u062a\u0648\u0636\u064a\u062d \u0644\u062a\u0645\u0631\u064a\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0625\u0644\u0649 \u062f\u0648\u0627\u0644 \u0644\u062a\u062d\u062f\u064a\u062f \u0627\u0644\u0642\u064a\u0645 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u062b\u0645 \u0637\u0628\u0627\u0639\u0629 \u062a\u0644\u0643 \u0627\u0644\u0642\u064a\u0645:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nvoid set(int arr[], int s)\r\n{\r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        cout &lt;&lt; \"Enter array value: \";\r\n        cin &gt;&gt; arr[i];\r\n    }\r\n}\r\n\r\nvoid print(int arr[], int s)\r\n{\r\n    for (size_t i = 0; i &lt; s; i++)\r\n    {\r\n        cout &lt;&lt; arr[i] &lt;&lt; \" \";\r\n    }\r\n}\r\n\r\nint main()\r\n{\r\n    int a[5];\r\n    set(a, 5);\r\n    print(a, 5);\r\n\r\n    return 0;\r\n}<\/pre>\n<p>\u062a\u0633\u0645\u062d \u062f\u0627\u0644\u0629 \u0627\u0644\u0645\u062c\u0645\u0648\u0639\u0629 \u0644\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0628\u062a\u0639\u064a\u064a\u0646 \u0627\u0644\u0642\u064a\u0645 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629\u060c \u0648\u062a\u0642\u0648\u0645 \u062f\u0627\u0644\u0629 \u0627\u0644\u0637\u0628\u0627\u0639\u0629 \u0628\u0637\u0628\u0627\u0639\u0629 \u0627\u0644\u0642\u064a\u0645 \u0627\u0644\u0645\u062e\u0632\u0646\u0629 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629. \u0625\u0646\u0647 \u0645\u062b\u0627\u0644 \u0639\u0645\u0644\u064a \u0644\u0643\u064a\u0641\u064a\u0629 \u0627\u0644\u0639\u0645\u0644 \u0645\u0639 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0627\u062a \u0648\u0627\u0644\u062f\u0648\u0627\u0644 \u0641\u064a \u0644\u063a\u0629 C++.<\/p>\n<h2>\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629<\/h2>\n<p><strong>\u0645\u062b\u0627\u0644 1:<\/strong><\/p>\n<p>\u064a\u064f\u0638\u0647\u0631 \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u062a\u0646\u0641\u064a\u0630 \u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 \"Bubble Sort\". \u0625\u0646 Bubble Sort \u0639\u0628\u0627\u0631\u0629 \u0639\u0646 \u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 \u0641\u0631\u0632 \u0628\u0633\u064a\u0637\u0629 \u062a\u062a\u0646\u0642\u0644 \u0628\u0634\u0643\u0644 \u0645\u062a\u0643\u0631\u0631 \u0639\u0628\u0631 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0631\u0627\u062f \u0641\u0631\u0632\u0647\u0627\u060c \u0648\u062a\u0642\u0627\u0631\u0646 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u062a\u062c\u0627\u0648\u0631\u0629\u060c \u0648\u062a\u0628\u062f\u0644 \u0645\u0648\u0627\u0642\u0639\u0647\u0645 \u0625\u0630\u0627 \u0643\u0627\u0646\u0648\u0627 \u0628\u0627\u0644\u062a\u0631\u062a\u064a\u0628 \u0627\u0644\u062e\u0627\u0637\u0626. \u064a\u062a\u0645 \u062a\u0643\u0631\u0627\u0631 \u0627\u0644\u0645\u0631\u0648\u0631 \u0639\u0628\u0631 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u062d\u062a\u0649 \u0644\u0627 \u062a\u0643\u0648\u0646 \u0647\u0646\u0627\u0643 \u062d\u0627\u062c\u0629 \u0644\u0644\u062a\u0628\u062f\u064a\u0644\u060c \u0645\u0645\u0627 \u064a\u0634\u064a\u0631 \u0625\u0644\u0649 \u0623\u0646 \u0627\u0644\u0642\u0627\u0626\u0645\u0629 \u0642\u062f \u062a\u0645 \u0641\u0631\u0632\u0647\u0627. \u0625\u0644\u064a\u0643 \u062a\u0641\u0627\u0635\u064a\u0644 \u0627\u0644\u0643\u0648\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    int vector[] = {6,5,4,1,2};\r\n    int t = 0;\r\n    \r\n \u00a0\u00a0\u00a0\/\/ Bubble Sort algorithm\r\n    for (size_t i = 0; i &lt; 5 - 1; i++)\r\n    {\r\n        for (size_t j = 0; j &lt; 5 - i - 1; j++)\r\n        {\r\n            if (vector[j] &gt; vector[j + 1])\r\n            {\r\n                t = vector[j];\r\n                vector[j] = vector[j + 1];\r\n                vector[j + 1] = t;   \r\n            }\r\n        }\r\n    }\r\n    \r\n    for (size_t i = 0; i &lt; 5; i++)\r\n    {\r\n        cout &lt;&lt; vector[i] &lt;&lt; endl;\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<ol>\n<li>int vector[] = {6, 5, 4, 1, 2};:<br \/>\n\u062a\u062a\u0645 \u062a\u0647\u064a\u0626\u0629 vector \u0625\u0644\u0649 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u0639\u062f\u0627\u062f \u0635\u062d\u064a\u062d\u0629 \u0628\u0642\u064a\u0645 \u063a\u064a\u0631 \u0645\u0635\u0646\u0641\u0629.<\/li>\n<li>int t = 0;:<br \/>\n\u062a\u0645 \u0627\u0644\u0625\u0639\u0644\u0627\u0646 \u0639\u0646 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0645\u062a\u063a\u064a\u0631 \u0627\u0644\u0635\u062d\u064a\u062d t \u0644\u062a\u0628\u062f\u064a\u0644 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0623\u062b\u0646\u0627\u0621 \u0639\u0645\u0644\u064a\u0629 \u0627\u0644\u0641\u0631\u0632.<\/li>\n<li>\u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 Bubble Sort :<br \/>\n\u064a\u062a\u0645 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062d\u0644\u0642\u0627\u062a for \u0627\u0644\u0645\u062a\u062f\u0627\u062e\u0644\u0629 \u0644\u062a\u0646\u0641\u064a\u0630 \u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 Bubble Sort. \u062a\u062a\u062d\u0643\u0645 \u0627\u0644\u062d\u0644\u0642\u0629 \u0627\u0644\u062e\u0627\u0631\u062c\u064a\u0629 (i) \u0641\u064a \u0639\u062f\u062f \u0627\u0644\u062a\u0645\u0631\u064a\u0631\u0627\u062a\u060c \u0628\u064a\u0646\u0645\u0627 \u062a\u0642\u0627\u0631\u0646 \u0627\u0644\u062d\u0644\u0642\u0629 \u0627\u0644\u062f\u0627\u062e\u0644\u064a\u0629 (j) \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u062a\u062c\u0627\u0648\u0631\u0629 \u0648\u062a\u0628\u062f\u0644\u0647\u0627 \u0625\u0630\u0627 \u0643\u0627\u0646\u062a \u062a\u062d\u062a\u0627\u062c \u0627\u0644\u062a\u0631\u062a\u064a\u0628.<\/li>\n<li>\u0625\u0630\u0627 \u0643\u0627\u0646 \u0627\u0644\u0639\u0646\u0635\u0631 \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a (index ) j \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0639\u0646\u0635\u0631 \u0627\u0644\u0645\u0648\u062c\u0648\u062f \u0641\u064a (index ) j + 1\u060c \u0641\u0633\u064a\u062a\u0645 \u0625\u062c\u0631\u0627\u0621 \u0645\u0628\u0627\u062f\u0644\u0629 \u0644\u0648\u0636\u0639\u0647\u0645\u0627 \u0641\u064a \u062a\u0631\u062a\u064a\u0628 \u062a\u0635\u0627\u0639\u062f\u064a.<\/li>\n<li>\u0637\u0628\u0627\u0639\u0629 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u062a\u064a \u062a\u0645 \u0641\u0631\u0632\u0647\u0627:<br \/>\n\u0628\u0639\u062f \u0627\u0643\u062a\u0645\u0627\u0644 \u0627\u0644\u0641\u0631\u0632\u060c \u064a\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u0643\u0648\u062f \u062d\u0644\u0642\u0629 for \u0644\u0637\u0628\u0627\u0639\u0629 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u062a\u064a \u062a\u0645 \u0641\u0631\u0632\u0647\u0627 \u0628\u062a\u0631\u062a\u064a\u0628 \u062a\u0635\u0627\u0639\u062f\u064a.<\/li>\n<\/ol>\n<p>\u0633\u064a\u0643\u0648\u0646 \u0646\u0627\u062a\u062c \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0647\u0648 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u062a\u064a \u062a\u0645 \u0641\u0631\u0632\u0647\u0627 \u0628\u062a\u0631\u062a\u064a\u0628 \u062a\u0635\u0627\u0639\u062f\u064a\u060c \u0648\u0647\u0648 \u0646\u062a\u064a\u062c\u0629 \u062a\u0637\u0628\u064a\u0642 \u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 Bubble Sort \u0639\u0644\u0649 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0623\u0648\u0644\u064a\u0629 \u063a\u064a\u0631 \u0627\u0644\u0645\u0635\u0646\u0641\u0629. \u0644\u0627 \u064a\u0639\u062f Bubble Sort \u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 \u0627\u0644\u0641\u0631\u0632 \u0627\u0644\u0623\u0643\u062b\u0631 \u0643\u0641\u0627\u0621\u0629 \u0644\u0645\u062c\u0645\u0648\u0639\u0627\u062a \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0627\u0644\u0643\u0628\u064a\u0631\u0629\u060c \u0648\u0644\u0643\u0646 \u0645\u0646 \u0627\u0644\u0633\u0647\u0644 \u0641\u0647\u0645\u0647\u0627 \u0648\u062a\u0646\u0641\u064a\u0630\u0647\u0627.<\/p>\n<p><strong>\u0645\u062b\u0627\u0644 2:<\/strong><\/p>\n<p>\u064a\u0642\u0648\u0645 \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0628\u0641\u0631\u0632 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u0639\u062f\u0627\u062f \u0635\u062d\u064a\u062d\u0629 \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 Bubble Sort. \u064a\u0642\u0648\u0645 \u0628\u0641\u0631\u0632 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u062a\u0631\u062a\u064a\u0628 \u062a\u0635\u0627\u0639\u062f\u064a \u062b\u0645 \u0637\u0628\u0627\u0639\u0629 \u0627\u0644\u0642\u064a\u0645 \u0627\u0644\u062a\u064a \u062a\u0645 \u0641\u0631\u0632\u0647\u0627. \u062f\u0639\u0648\u0646\u0627 \u0646\u062d\u0644\u0644 \u0627\u0644\u0643\u0648\u062f \u062e\u0637\u0648\u0629 \u0628\u062e\u0637\u0648\u0629:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nconst int s = 5;\r\nvoid sort(int arr[])\r\n{\r\n    int t = 0;\r\n    for (size_t i = 0; i &lt; 5 - 1; i++)\r\n    {\r\n        for (size_t j = 0; j &lt; 5 - i - 1; j++)\r\n        {\r\n            if (arr[j] &gt; arr[j + 1])\r\n            {\r\n                t = arr[j];\r\n                arr[j] = arr[j + 1];\r\n                arr[j + 1] = t;   \r\n            }\r\n        }\r\n    }\r\n}\r\n\r\nvoid print(int vector[])\r\n{\r\n    for (size_t i = 0; i &lt; 5; i++)\r\n    {\r\n        cout &lt;&lt; vector[i] &lt;&lt; endl;\r\n    }\r\n}\r\n\r\nint main()\r\n{\r\n    int vector[] = {0,-1,55,-5,-100};\r\n    sort(vector);\r\n    print(vector);\r\n    return 0;\r\n}\r\n<\/pre>\n<p>\u0633\u064a\u0643\u0648\u0646 \u0646\u0627\u062a\u062c \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0647\u0648 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u062a\u064a \u062a\u0645 \u0641\u0631\u0632\u0647\u0627 \u0628\u062a\u0631\u062a\u064a\u0628 \u062a\u0635\u0627\u0639\u062f\u064a\u060c \u0648\u0647\u0648 \u0646\u062a\u064a\u062c\u0629 \u062a\u0637\u0628\u064a\u0642 \u062e\u0648\u0627\u0631\u0632\u0645\u064a\u0629 Bubble Sort \u0639\u0644\u0649 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0623\u0648\u0644\u064a\u0629 \u063a\u064a\u0631 \u0627\u0644\u0645\u0635\u0646\u0641\u0629.<\/p>\n<p><strong>\u0645\u062b\u0627\u0644 3:<\/strong><\/p>\n<p>\u064a\u0648\u0636\u062d \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0643\u064a\u0641\u064a\u0629 \u0639\u0643\u0633 \u0639\u0646\u0627\u0635\u0631 \u0645\u0635\u0641\u0648\u0641\u0629 \u0623\u0639\u062f\u0627\u062f \u0635\u062d\u064a\u062d\u0629 \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u062f\u0627\u0644\u0629 reversArray. \u064a\u0642\u0648\u0645 \u0628\u0639\u0643\u0633 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0641\u064a \u0645\u0643\u0627\u0646\u0647\u0627 \u062b\u0645 \u064a\u0637\u0628\u0639 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0645\u0639\u0643\u0648\u0633\u0629:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#include &lt;iostream&gt;\r\nusing namespace std;\r\n\r\nvoid reversArray(int arr[], int s)\r\n{\r\n    for (size_t i = 0; i &lt; s \/ 2; i++)\r\n    {\r\n        swap(arr[i], arr[s - i - 1]);\r\n    }\r\n}\r\n\r\nint main()\r\n{\r\n    int vector[] = {3,2,4,5,6};\r\n    reversArray(vector, 5);\r\n    for (size_t i = 0; i &lt; 5; i++)\r\n    {\r\n        cout &lt;&lt; vector[i] &lt;&lt; \" \";\r\n    }\r\n\r\n    return 0;\r\n}\r\n<\/pre>\n<p>\u0633\u064a\u0643\u0648\u0646 \u0646\u0627\u062a\u062c \u0647\u0630\u0627 \u0627\u0644\u0643\u0648\u062f \u0647\u0648 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0645\u0639\u0643\u0648\u0633\u0629\u060c \u062d\u064a\u062b \u064a\u062a\u0645 \u0639\u0643\u0633 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0641\u064a \u0645\u0643\u0627\u0646\u0647\u0627. \u0648\u064a\u062a\u0645 \u062a\u062d\u0642\u064a\u0642 \u0630\u0644\u0643 \u0639\u0646 \u0637\u0631\u064a\u0642 \u062a\u0628\u062f\u064a\u0644 \u0627\u0644\u0639\u0646\u0635\u0631 \u0627\u0644\u0623\u0648\u0644 \u0628\u0627\u0644\u0639\u0646\u0635\u0631 \u0627\u0644\u0623\u062e\u064a\u0631\u060c \u0648\u0627\u0644\u0639\u0646\u0635\u0631 \u0627\u0644\u062b\u0627\u0646\u064a \u0628\u0627\u0644\u0639\u0646\u0635\u0631 \u0627\u0644\u062b\u0627\u0646\u064a \u0625\u0644\u0649 \u0627\u0644\u0623\u062e\u064a\u0631\u060c \u0648\u0647\u0643\u0630\u0627. \u0625\u0646\u0647\u0627 \u0637\u0631\u064a\u0642\u0629 \u0628\u0633\u064a\u0637\u0629 \u0648\u0641\u0639\u0627\u0644\u0629 \u0644\u0639\u0643\u0633 \u062a\u0631\u062a\u064a\u0628 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0641\u064a \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u0645\u0644\u062d\u0648\u0638\u0629 !<\/strong><\/p>\n<p>\u0625\u0630\u0627 \u0643\u0646\u062a \u0644\u0627 \u062a\u0631\u063a\u0628 \u0641\u064a \u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u062e\u0627\u0635\u0629 \u0628\u0643\u060c \u0641\u064a\u0645\u0643\u0646\u0643 \u062a\u0647\u064a\u0626\u0629 \u0642\u064a\u0645\u062a\u0647\u0627 \u0643\u0642\u064a\u0645\u0629 \u062b\u0627\u0628\u062a\u0629 \u0641\u064a \u0627\u0644\u062f\u0627\u0644\u0629. \u0645\u062b\u0627\u0644:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">void print(const int arr[], int s)\r\n{\r\n    \/\/body of the function\r\n}<\/pre>\n<p>\u0628\u0647\u0630\u0647 \u0627\u0644\u0637\u0631\u064a\u0642\u0629 \u0641\u0625\u0646 \u0623\u064a \u0645\u062d\u0627\u0648\u0644\u0629 \u0644\u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0633\u062a\u0624\u062f\u064a \u0625\u0644\u0649 \u062d\u062f\u0648\u062b \u062e\u0637\u0623.<\/p>","protected":false},"excerpt":{"rendered":"<p>In C++, you can pass an array to a function, and this is a fundamental concept when working with arrays. When you pass an array to a function, you&#8217;re essentially allowing that function to operate on the array&#8217;s elements or modify the array if needed. Here&#8217;s an explanation of how to pass an array to [&hellip;]<\/p>","protected":false},"author":3,"featured_media":0,"parent":2744,"menu_order":32,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-10053","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/10053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/comments?post=10053"}],"version-history":[{"count":9,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/10053\/revisions"}],"predecessor-version":[{"id":10062,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/10053\/revisions\/10062"}],"up":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/2744"}],"wp:attachment":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/media?parent=10053"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/doc_tag?post=10053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}