MIPI_BaseC_WebinarFRTK/25_Seminar12/04_macros_swap_p13.c

15 lines
230 B
C
Raw Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
#define SWAP(type,a,b) {type t = a; a = b; b = t;}
int main(void)
{
int a=5, b=7;
if (a<b)
SWAP(int, a,b)//{...}
else
a = 1000;
printf("a = %d b = %d\n", a, b);
return 0;
}