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

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

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