I'm trying to use scanf to store something in a 2D array and print it out, except im not sure how to do this.. can any body help?
for example:
Input:
******
*AAAA*
*AAAA*
******
output:
******
*AAAA*
*AAAA*
******
Thank you
Printable View
I'm trying to use scanf to store something in a 2D array and print it out, except im not sure how to do this.. can any body help?
for example:
Input:
******
*AAAA*
*AAAA*
******
output:
******
*AAAA*
*AAAA*
******
Thank you
Use fgets() rather than scanf() and read in each line individually into the array. If you don't want to deal with null characters, you can use getchar() in a loop incrementing the array index until you're at the end of the array.