Friday, July 31, 2009

About in turbo c or c language..?

how to put an space in turbo c?... i mean the outcome of the program have a space.. i dont know what i gonna enter to display a space between a name after u run it.. please help..

About in turbo c or c language..?
try this .... it will take space bars also


char a[20];


printf("Enter String: ");


gets(a);


printf("Your String: %s",a);
Reply:Well done Joydeep for deciphering and answering such a badly worded question! Thumbs up to you :P Report It

Reply:Well, if you use the printf function then the format for a space is to simply include it in the format string. Example:


printf("%s is a good person.\tDon't you think?\n", MyName);


will print:


Griz803 is a good person. Don't you think?


%26lt;and leaves cursor on this line%26gt;


assuming MyName contains Griz803.


Other tutorials on C language can be found from this link, as well as tools, compilers and other free stuff.
Reply:Where do you want this space to be placed?


On the console? - printf( " " );


If you want to print some name followed by the space -- printf( "%s ", name );
Reply:Could you be more specific? Do you mean space as in a single space character, or as in whitespace, or something else? The context of this space is also highly unclear. Perhaps a code example of what you have so far might help?


No comments:

Post a Comment