Hello.
I want to ask is there some way how to write multi dimensional string? I want to write/output this string.
Thanks for helpCode:char field[7][16]={"-----------------", "| |", "| |", "| |", "| |", "| |", "| |", "| |"};
Hello.
I want to ask is there some way how to write multi dimensional string? I want to write/output this string.
Thanks for helpCode:char field[7][16]={"-----------------", "| |", "| |", "| |", "| |", "| |", "| |", "| |"};
It's just a for loop printing field[i]
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
i dont know how exactly do it can you help me please?
Do you know what a for loop looks like?
Do you know how to use printf("%s"
- with a char array
- with a char pointer
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
yeah but it doesnt work.. :/
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
sorry..i try to do in this way but its all in one line..in for it doesnt work or im doing it bad
Code:char field[7][16]={"-----------------\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n", "| |\n"}; puts(field);
Each of those strings is 20 characters wide, so how you're not getting notification by your compiler when you try to initialize that into a 16-character space I don't know.
Also, for loops involve the word for, so that may be a good place to start looking in your notes/book.
thank you its working now!