I am very new to C and am finding that strings in C are giving me quite the headache. I have a program that prints out some data from my struct that holds information on an object. I have an array of these structs and I want to print the data with a nice message. here is the kicker, I am using UDP socket programming and my server handles this information and sends a char array (string) back in which I then print this. Is there an easy way I can achieve this
printf("Economy capacity: %d\n", database[index].ecap);
but instead of printing it, assign this statement to a char array? this does not work
strcpy(output,"Premium capacity: %d\n", database[index].pcap);
sprintfor preferablysnprintf