小编Anu*_*eev的帖子

这个 C++ 代码如何在没有函数定义的情况下运行

任何人都可以解释这个程序中定义函数的工作背后的逻辑。即使在评论整个函数逻辑之后,这也会在这种情况下给出正确的输出。

#include <iostream>
using namespace std;
void swap(int *a, int *b)
{ /*
int temp=0;
 temp= *a;
 *a= *b;
 *b=temp;
*/
}
int main()
{
    int x, y;
    cout << "This program is the demo of function call by pointer \n\n";
    cout << "Enter the value of x & y \n";
    cout << "x: ";
    cin >> x;
    cout << "y: ";
    cin >> y;
    cout << "Value befor swap " << endl;
    cout << "x= " << x << …
Run Code Online (Sandbox Code Playgroud)

c++ swap std

1
推荐指数
2
解决办法
107
查看次数

标签 统计

c++ ×1

std ×1

swap ×1