#include <stdio.h>
#include <stdlib.h>
struct Complexo {
int real;
int imaginario;
};
struct Complexo insereComplexo(int r, int i){
struct Complexo novo;
novo.real = r;
novo.imaginario = i;
return novo;
}
void somaComplexo(struct Complexo *a, struct Complexo b){
a->real += b.real;
a->imaginario += b.imaginario;
}
int main(int argc, char *argv[]){
struct Complexo a, b;
a = insereComplexo(4,7);
b = insereComplexo(8,10);
somaComplexo(&a, b);
return 0;
}
//https://pt.stackoverflow.com/q/303412/101
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnN0cnVjdCBDb21wbGV4byB7CiAgaW50IHJlYWw7CiAgaW50IGltYWdpbmFyaW87Cn07CgpzdHJ1Y3QgQ29tcGxleG8gaW5zZXJlQ29tcGxleG8oaW50IHIsIGludCBpKXsKICBzdHJ1Y3QgQ29tcGxleG8gbm92bzsKICBub3ZvLnJlYWwgPSByOwogIG5vdm8uaW1hZ2luYXJpbyA9IGk7CiAgcmV0dXJuIG5vdm87Cn0KCnZvaWQgc29tYUNvbXBsZXhvKHN0cnVjdCBDb21wbGV4byAqYSwgc3RydWN0IENvbXBsZXhvIGIpewogIGEtPnJlYWwgKz0gYi5yZWFsOwogIGEtPmltYWdpbmFyaW8gKz0gYi5pbWFnaW5hcmlvOwp9CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKXsKICBzdHJ1Y3QgQ29tcGxleG8gYSwgYjsKICBhID0gaW5zZXJlQ29tcGxleG8oNCw3KTsKICBiID0gaW5zZXJlQ29tcGxleG8oOCwxMCk7CiAgc29tYUNvbXBsZXhvKCZhLCBiKTsKICBwcmludGYoIiVkXG4iLCBhLnJlYWwpOwogIHByaW50ZigiJWRcbiIsIGEuaW1hZ2luYXJpbyk7CiAgc3lzdGVtKCJwYXVzZSIpOwogIHJldHVybiAwOwp9CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8zMDM0MTIvMTAx