Search
 
SCRIPT & CODE EXAMPLE
 

C

how to join an array of strings c

#include <string.h>

char** myArray = { "hello", "world", "hello", "world", "wow!" };

char* query = myArray[0]; // you can also set this to ""

int i = 1;
while (myArray != NULL)
{
  strcat(query, " "); // add a space first
  strcat(query, myArray[i]);
  i++;
}

printf(myArray);

// hello world hello world wow!
Comment

PREVIOUS NEXT
Code Example
C :: Create the static library libmy.a containing all the functions listed below: 
C :: notation of positive in c 
C :: string in c and how it works 
C :: threads in c 
C :: define constant c 
C :: print the name of a file c 
C :: open a file in from terminal 
C :: atoi string to int 
C :: functions in c programming 
C :: c programming programiz 
C :: man strstr 
C :: c read file from command line 
C :: fungetc 
C :: type cast in c 
C :: c to c convertor 
C :: add c program 
C :: C Character l/O 
C :: scranton inhabitants 
C :: ejemplo c holamundo 
C :: produit deux matrice 
C :: c math.h sqrt 
C :: UTC offset upper limit 
C :: type conversion 
C :: WAP to create Database using array of structure & display it in C 
C :: c how to include variables of other c file 
C :: unconstrained box flutter 
C :: c static variable 
C :: C++ initalize int16_t value 
C :: c Write a program to reverse an array or string 
C :: mongodb delete all documents 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =