605 views|6 replies

970

Posts

0

Resources
The OP
 

Is it possible to pass an int variable to a longlong parameter in a function? [Copy link]

邀请:@maychang   @chunyang   @damiaa   @huo_hu   参与回复

Is it possible to pass the int variable b to the longlong parameter b in function1? The specific code is as follows:

void function1 (long long b)
{

........

}

main(){

int a;

a=100;

function1(a);

}

This post is from stm32/stm8

Latest reply

Yes, there is no problem with passing it as a parameter.   Details Published on 2023-12-31 21:13
 

6570

Posts

0

Resources
2
 

I don't even understand these lines of code.

Remember to pass by reference when passing Integer as a parameter

This post is from stm32/stm8
 
 

874

Posts

0

Resources
3
 

This is OK. There is no problem passing int as a function parameter to a long long type parameter.

This post is from stm32/stm8
 
 

7422

Posts

2

Resources
4
 

Yes, you just need to know whether you can lose it or not.

This post is from stm32/stm8
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

725

Posts

4

Resources
5
 

You can pass an int value to a function whose parameter type is defined as long long, and the compiler will perform type promotion.

This post is from stm32/stm8
 
 
 

4764

Posts

12

Resources
6
 

It is equivalent to converting the type for you, so it is possible, but it is not recommended to use it in this way because you will get confused.

This post is from stm32/stm8
 
 
 

6748

Posts

2

Resources
7
 

Yes, there is no problem with passing it as a parameter.

This post is from stm32/stm8
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list