57 lines
764 B
C
57 lines
764 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
/**
|
|
* Return into
|
|
* eax
|
|
*/
|
|
unsigned int f0(unsigned int a){
|
|
return 2*a;
|
|
}
|
|
|
|
/**
|
|
* Return into
|
|
* rax
|
|
*/
|
|
unsigned long f1(unsigned long a){
|
|
return 2*a;
|
|
}
|
|
|
|
unsigned short f2(unsigned short a){
|
|
return (short)(2*a);
|
|
}
|
|
|
|
void fp0(int *a){
|
|
*a=2*(*a);
|
|
}
|
|
|
|
void fp1(long *a){
|
|
*a=2*(*a);
|
|
}
|
|
|
|
int main(){
|
|
printf("Hello f0: %d\n",f0(1));
|
|
printf("Hello f1: %ld\n",f1(2));
|
|
printf("Hello f2: %d\n",f2(2));
|
|
|
|
int* ip = malloc(sizeof(int));
|
|
long* lp = malloc(sizeof(long));
|
|
|
|
*ip=12;
|
|
*lp=21;
|
|
|
|
printf("IPointer:\t %p, %d\n",ip, *ip);
|
|
printf("LPointer:\t %p, %ld\n",lp, *lp);
|
|
|
|
fp0(ip);
|
|
fp1(lp);
|
|
|
|
printf("IPointer:\t %p, %d\n",ip, *ip);
|
|
printf("LPointer:\t %p, %ld\n",lp, *lp);
|
|
|
|
fp0(ip);
|
|
fp1(lp);
|
|
|
|
free(ip);
|
|
free(lp);
|
|
}
|