我如何从函数返回两个整数

时间:2019-03-25 19:24:00

标签: c msp430

我想创建一个函数并返回两个整数:i和c。我怎样才能做到这一点? 预先感谢

a++ ;
 if(i == 288){
 a = 0 ;
 i-- ;
 b++ ;
 c++ ;
 } 
 if(c == 5000) {

 i = 0 ;
 c = 0 ;

 }
  if(a == 1 ){
   P2OUT = 0xFF ;
  a = 0 ;
  }
 if (b == 1){
 P2OUT= 0x00 ;
 b = 0 ; 

 }

1 个答案:

答案 0 :(得分:2)

struct s1
{
    int a;
    int b;
    /* more */
}

struct s1 foo(/* ... */)
{
    struct s1 s;

    s.a = /* something */;
    s.b = /* something */;
    /* more */
    return s;
}

int foo1(int *a, int *b /*, .... */ )
{
    *a = /* something */;
    *b = /* something */;
    return /* something */;
}