Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

c2h problem!

My nios ii version is 8.0,and i used c2h in it ,the function is

unsigned short add(unsigned short a,unsigned short b){

unsigned short sum=0;

sum=a+b;

return sum;

}

and main function is

int main()

{

unsigned short s1=10,s2=10;

unsigned s;

//printf("Hello from Nios II!\n");

s=add(s1,s2);

printf("the sum is %ld\n",(long)s);

return 0;

}

the result is the sum is 1

why?why did i get wrong result with c2h?

My nios is the crack,so i download the limited sof to board
No RepliesBe the first to reply