Printing space between strings when using strcat() function [closed] - c

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How to print a space between two strings using strcat() function in c language?

You can do something like this.
strcat(string1, " ");
strcat(string1, string2);
or, just in one line.
strcat(strcat(string1, " "),string2)
Both the snippets are actually same!

Related

Is there any usage for ' * ' in C else than multiplication and pointer? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Is the any more use of *, but for pointers *p and multiplication a*b ? If yes what usage it has?
Yes, it's part of multi-line comment syntax /*insert comment here*/

including "vartype" library to the beginning of the C program [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to have some information about (#include)
in the beginning of my C program.
What does this library do?I have search before and found nothing.....
#include is a preprocessor directive, not a library. You can read below Wikipedia page about it.
https://en.wikipedia.org/wiki/Include_directive

Character functions vs string functions [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I just found a short code here, which would detect blank lines in a file. It used fgets() function in C library.
I wonder if character functions are better suited for files which have tabs, and perhaps continous spaces.
My qustion is what is the best way to parse a file for blank lines?
You can also use scanf(" %[^\n]s",string); in order to read spaces but fgets is best solution for your case.

offsetof with char as second argument. Is it possible? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'd love to create some part dynamically. Would it be possible to use offsetof with string as a second argument? Something like:
offsetof( tic, "close.v");
Or can I convert char to member anyhow?
The offsetof construct is a compile time operation. It can't be used with anything that is generated dynamically.

Format Codes in my function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
In C/C++, is there a way to write my function so that I can use format codes to print information easier? The function draws text to the screen with SDL, so I can't pass in a C++ string; it has to be a char array.
Firstly, you can convert a c++ string to a char array using myString.c_str().
Also, you can use sprintf() with format codes to produce a string. Then you can draw that string using SDL. For example:
char myString[1024];
sprintf(myString, "Hello my name is %s", "foo");
draw_using_SDL(myString);

Resources