Hi,
This code works#include <stdio.h>
int main()
{
char buff[50];
int ret, a = 34;
ret = sprintf(buff, "%d",a);
printf ("\n\nbuf as text is: %s and the buffer has %d characters.\n\n",buff,ret);
return 0;
}
Can someone explain to me why the following compiles, but does not run:
#include <stdio.h>
int main()
{
char buff[50];
int ret, a = 34;
ret = sprintf(buff, "%d",a);
printf ("\n\nbuf as text is: %s and the buffer has %d characters.\n\n",buff[0],ret);
return 0;
}
On a sidenote: I continue, hopefully not forever, to have problems with the concept of pointers.
Anyway, on the last code block, doesn't integer "a" get written to the first cell of buff as text?
Thanks in advance for all help,
... Ed