I am new to working with arrays in C and I am trying to store a string like so:
//x, y, p are floats
("X: %f\nY: %f\nP: %f", x, y, p)
into an array.
I do not know how to read in the values x
, y
, p
so that the array stores it as a single string.
Is it possible? If not, how should I do this?
UPDATE
So apparently people don't understand what I mean.
The above is not my specific code, it is the string I wish to store; an example.
printf("X: %f\nY: %f\nP: %f", x, y, p);
is equal to when printed in the command:
X: 10.000000
Y: 12.000000
P: 32.000000
This is how I wish to store it in an array, instead, it is recognising it as 4 arguments, instead of 1.
- the string = "X: %f\nY: %f\nP: %f"
- x
- y
- p
How can I make it recognise it as one argument?