Say I have a code like this:
Code:
int main() {
int a=1;
int b=2;
int x=3;
int y=4;
FILE *writefile;
char *filename = "test.out";
writefile = fopen(filename, "w");
char data[] = "";
fwrite(data, 1, sizeof(data), writefile);
fclose(writefile);
}
If I put a, b, and c in data[] like "char data[] = {'a', 'b', 'c'};" it will write this into "test.out":
I'm trying to write my code so that it will write something like:
Int a is: 1
Int b is: 2
Int x is: 3
Int y is: 4
How would I go about doing this? Should I even use a char array?