Before looking at the code, here's an explanation: NIDAQmx is a hardware-in-the-loop integration software from National Instruments. They give this sample code to create any voltage out of the card. The variable "float64 data[1]" is a double precision floating point that defines the actual voltage being emitted from the card; it is referenced later in the fourth line with function "DAQmxErrChk". However, despite my best efforts, I cannot seem to change that voltage. This is because it is in curly braces, which is a permanent array initialization. But, when I take the curly braces off or try to define data in another line of code, I get cross-type errors. The code is exclusive to DAQmx, so it may look confusing, but all I'm having problems with is data.

#include <stdio.h>
#include <NIDAQmx.h>

#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else//if it finds an error, stop running.

int main()
	int			error=0;
	TaskHandle	taskHandle=0;
	char		errBuff[2048]={'\0'};//error message
	float64		data[1] = {7.00};//problem variable
	printf("%f\n",data[1]);//print it, which works
	DAQmxErrChk (DAQmxCreateTask("",&taskHandle));//create a task
	DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,""));//assign the task a channel
	DAQmxErrChk (DAQmxStartTask(taskHandle));//start the task
	DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));//put voltage through the channel

	if( DAQmxFailed(error) )
	if( taskHandle!=0 ) 
	if( DAQmxFailed(error) )
		printf("DAQmx Error: %s\n",errBuff);//print the error message
	printf("End of program, press Enter key to quit\n");
	return 0;

> But, when I try to define data in another line of code, I get cross-type errors.

Can you show how you do it?

The problem is not how to redefine it; the problem is that float64 will not let me. And it has to be float64. I was wondering if there was a way around that "no redefine" rule for float64.

Still, we need to see the code which produces error.

float64		data[1] = 7.00;

When I do that, it gives me a DAQmx error. It doesn't allow a double precision to be changed in this way. Is there another way for double precision to be changed?

float64		data[1];

That last post had the wrong code. But here's the real problem: This gives me a DAQmx error. Specifically, the printf() prints "data" as 0.000000, and the DAQmx code recognizes "data" as -92.5563......e+61 or something like that. And I change the value of data in that second line as much as I want, but still that same insane number. Also, the very first printf() code I posted also turns data[1] up as that insane number, but if the printf() references "data" and not "data[1]" it works.

The problem is that data is one-element array. The only valid element is data[0] . Accessing data[1] is illegal. Try data[0] = whatever .

Thank you thank you thank you (etc.) How could I have been so dumb??? It works now. Sorry for my ignorance.... :(