c - Multiple string concatenation -


this question has answer here:

i'm new c language , loadrunner.

how do string concatenation in c.

pseudo code:

string second = "sec"; string fouth = "four"; system.out.println("first string" + second +"third" + fouth); 

if sure target string can accommodate, can use snprintf,

#define size 1024  char target[ size ]; // .. .. snprintf( target, sizeof( target ), "%s%s%s", str1, str2, str3 ); 

for case,

snprintf( target, sizeof( target ), "%s%s%s%s", "first string", second, "third", fourth ); 

of course, second , fourth should valid string (character array).


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -