What is the size of this array?
float a[10];
Enough to 10 floats. It depends of implementation. In most implemetations of C compilers float is 4 bytes long, so it will be at least 4 * 10 bytes. In C there is sizeof
, use it!
Look for a C manual (sizeof keyword):
#include <stdio.h>
int main(void)
{
float a[10];
printf("sizeof float %d\n", sizeof(float) );
printf("sizeof array %d\n", sizeof(a) );
printf("array size %d\n", sizeof(a)/sizeof(a[0]) ); // sizeof(a[0]) is the same with sizeof(float)
return 0;
}
Hope it is not too hard.