# C programming question - using in arduino



## shuggans (Jan 20, 2013)

Hey all - my friend and I are trying to get this code to work, but the compiler is giving us the error: "initializer fails to determine size of '__c'".  

We are TRYING to create a variable, then assign it the value of whatever is read on the rx serial port pin, then printf that variable.  


```
#include "hardware.h"


// Initialise the hardware
void appInitHardware(void) {
	initHardware();
}
// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
	return 0;
}
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {

if(myUart.isRxBufferEmpty() == false) {
	int InstreamData = myUart.read();
	if(InstreamData != 0){
		PRINTF(stdout,InstreamData);
	}
}
	return 0;
}
```


----------



## de.das.dude (Jan 20, 2013)

i think the size of your code is greater than what the chip you have can take
also where is nothing in the program? all of them are comments?


i may be wrong, i dont have much arduino knowledge. but no one replied so here i am.


----------



## shuggans (Jan 20, 2013)

These chips can handle WAYYY more code than this .  The problem I dont believe its even related to arduino or the chip at all.. this is a c compiler giving the error before it ever hits the chip


----------



## de.das.dude (Jan 20, 2013)

```
#include <hardware.h>


// Initialise the hardware
void appInitHardware(void)
{
	initHardware();
}
// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart)
{
	return 0;
}
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount,TICK_COUNT loopStart)
{

if(myUart.isRxBufferEmpty()==false) 
           {
	        int InstreamData=myUart.read();
	        if(InstreamData!=0)
                   {
		printf(stdout,InstreamData);
	        }
           }
	return 0;
}
```


try this. copy paste it.

ithink i may have fixed a couple of grammatical errors. have you tried running it in borland C ?


----------



## W1zzard (Jan 20, 2013)

Mentioning the line number for the error would make things much easier 

You are using printf wrong. Parameter 1 is a format string, not a file handle (looking for fprintf?)

http://playground.arduino.cc/Main/Printf

also see the comment on that page about PSTR()


----------



## shuggans (Jan 20, 2013)

line 23: the printf error.  I think it's because we're tryign to call a dynamic value


----------

