PHP Code:
char result[] = concat((char)area_camada,"-",(char)boxes_camada,"-",(char)wires_camada,"]");
Why?Quote:
invalid initializer
Printable View
PHP Code:
char result[] = concat((char)area_camada,"-",(char)boxes_camada,"-",(char)wires_camada,"]");
Why?Quote:
invalid initializer
With this i want a result like this for example lets assume that:
int area_camada = 33
int boxes_camada = 45
int wires_camada = 8533
The result would be:
"33-45-8533]"
Use sprintf?
sprintf works just like printf, except it has a first argument that is a char pointer (or array) that is the destination, instead of the "console" where printf normally ends up.
So if you know how to print the string using printf, then all you need to do is change it like this:
--Code:#include <stdio.h>
int main()
{
char buf[100];
printf("Hello, World!\n");
sprintf(buf, "Hello, World from sprintf\n");
printf("%s", buf);
return 0;
}
Mats
Thanks that solves my problem!