Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
C - Append Character to String
#include <stdio.h> #include <string.h> int main(int argc, char **argv) { // Define a string. char *str = malloc(4 * sizeof(char)); strcpy(str, "Hild"); // Define a char, and convert it to a string. char c = 'a'; char *cStr = malloc(sizeof(char)); *cStr = c; // Append one character to a string. size_t len = strlen(str); str = realloc(str, len + sizeof(char)); strcat(str, cStr); printf("My name is %s.\n", str); // Free memory. free(cStr); free(str); return 0; }
run
|
edit
|
history
|
help
1
cv2
Lazy dope vectors by Henry Kroll III www.thenerdshow.com
Concatenate Strings
correccion
struct
UDP - Male/Velke pismena
Linear Classifier in C
Regiones A y B
lab7
cv3