Well i am not so new with the 'C' programming language, but after trying hard to debug, i still cannot get why my code unable to print spaces when i dont see any problems with it
code :
Code:while( i < 10) { arr[i] = (char)" "; i++; }
Well i am not so new with the 'C' programming language, but after trying hard to debug, i still cannot get why my code unable to print spaces when i dont see any problems with it
code :
Code:while( i < 10) { arr[i] = (char)" "; i++; }
Last edited by NetworkeR; 03-11-2009 at 12:27 PM.
The code looks good, but please check if you initialized the integer variable "i" before you used it in the while loop, also what is the size of the array that you have declared. also check if all the braces used are properly placed.. Please let me know if the "spaces" are still not printed.
kelfro I have checked those several times. The integer variable "i" has been initialized to "0", the array "arr" has been declared so as to save "10" characters. Also all the braces are at their respective places. Now what...???
Theres a lot of difference between" " and ' '. ' ' is how the space character is denoted whereas " " is a string which is totally different from the space character which you want to print. so if you just replace the " " with ' ', your program should give you 10 spaces in the array that you need.
code:
Let me know if there are still any problems with this code fragment.Code:while( i < 10) { arr[i] =' '; i++; }
Last edited by MindSpace; 03-11-2009 at 12:45 PM.
Bookmarks