Which exchanges (currency exchanges) are CSWAP coins listed on?
The problem of using the SWAP function as an actual parameter in the C language.
The relationship between formal parameters and actual parameters in C language is: the formal parameter is a copy of the value of the actual parameter. Regardless of the type of the parameter, the formal parameters passed to the subfunction are only the values of the actual parameters. Therefore, when changing the value of the formal parameter variable itself, it has nothing to do with the actual parameters. In other words, changes to the formal parameters will not affect the actual parameters.
However, if the parameter type is a pointer type, you can change the data in the actual parameter address by modifying the data in the address pointed to by the pointer variable.
Therefore, when using the SWAP function to exchange data, two points must be guaranteed:
The parameter must be a pointer type, pointing to the data to be exchanged
When exchanging, the data in the address must be exchanged, not the address itself.
Reference code:
//Wrong exchange code 1
voidswap1(inta,intb)//The parameter is not a pointer to the data to be exchanged
{
intt=a;
a=b;
b= t;
}
//Wrong exchange code 2
voidswap2(int*a,int*b)
{
int*t=a;//Exchange the formal parameter variable itself
a=b;
b=t;
}
//Correct exchange code
voidswap(int*a,int*b)
{
intt=*a;//Exchange the data in the formal parameter variable address, Pointer variables remain unchanged
*a=*b;
*b=t;
}
Why can’t the C language swap function be implemented
The poster needs to have a deeper understanding of the parameters and return values of the function~
First of all The return value of a function must be only one variable. The return(a,b) in your swap function may not pass the compilation~
At the same time, the parameters of the function can be passed in three forms: address, value, and reference. In your case, it is recommended to use the pointer method to directly modify the values of a and b in swap. The code is as follows:
void swap(int*a, int*b)
{
int t;
t=*a;
*a=*b;
*b= t;
}
The method called in main is swap(&a,&b);
The above is the detailed content of Which exchanges (currency exchanges) are CSWAP coins listed on?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In a devastating blow to investors, the OM Mantra cryptocurrency has collapsed by approximately 90% in the past 24 hours, with the price plummeting to $0.58.

The crypto market has witnessed a rebound following the recent sheer downturn. As per the exclusive market data, the total crypto market capitalization has reached $2.71Ts

Have you noticed the meteoric rise of meme coins in the cryptocurrency world? What started as an online joke has quickly evolved into a lucrative investment opportunity

As fear drives selling in the crypto market, major coins like Cardano and Solana face tough times.

In the rapidly evolving world of blockchain technology, EY's Nightfall protocol has emerged as a significant development.

Bitwise, a leading digital asset manager, has announced the listing of four of its crypto Exchange-Traded Products (ETPs) on the London Stock Exchange (LSE).

The draft bill purportedly aims to address environmental impacts from rising energy demand and protect households from higher energy bills

In an announcement made earlier today, Japanese firm Metaplanet revealed it has acquired another 319 Bitcoin (BTC), pushing its total corporate holdings beyond 4,500 BTC.