How many bits are short, long etc int?

All design tool related questions: compiler, assembler, linker. Embedded programming questions: assembler, C code.

Moderator: nferre

Posts: 15
Joined: Wed May 16, 2007 8:10 pm

How many bits are short, long etc int?

Tue Mar 31, 2009 3:16 pm

Hello, i have a question.

I'm using a GNU C compiler for ARM7 (at91sam7s256), and i don't know in this compiler, how many bits are the next:

short int
long int

and so on.

I have to communicate over SPI protocol, and i have to use 16bits commands, i guess they are short int, but i don't have any idea.

Many thanks.
Posts: 14
Joined: Fri Mar 20, 2009 4:31 pm

Re: How many bits are short, long etc int?

Wed Apr 01, 2009 3:57 pm

printf("%d %d %d %d",sizeof(int),sizeof(char),sizeof(long),sizeof(short));

and you are sure , that should work.
I think you can echo them out in compiling time also,but I don't know how.
Kevin Genskowsky
Electronic Ingeniering

Return to “Development Tools”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests