PHP Code:
char result[] = concat((char)area_camada,"-",(char)boxes_camada,"-",(char)wires_camada,"]");
Why?invalid initializer
PHP Code:
char result[] = concat((char)area_camada,"-",(char)boxes_camada,"-",(char)wires_camada,"]");
Why?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?
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Thanks that solves my problem!