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
Ordena de menor a mayor 3 numeros
vyměna proměnych pomoci parametru
Euclides 2
Triángulo Asteriscos
lab7
Linear Classifier in C
prog0
Herout (67) - 5
Lazy dope vectors by Henry Kroll III www.thenerdshow.com
Vzdalenost