updates to articles
This commit is contained in:
parent
4c3b20b2f4
commit
c2bf60bebc
82 changed files with 30210 additions and 8 deletions
|
@ -22,11 +22,17 @@ void main () {
|
|||
|
||||
// input
|
||||
printf("Enter strings to print: \n");
|
||||
const size_t str_size = 100;
|
||||
for (i = 0; i < 5; i++) {
|
||||
strings[i] = malloc (100 * sizeof(char));
|
||||
string_cpy[i] = malloc (100 * sizeof(char));
|
||||
fgets(strings[i],100,stdin);
|
||||
strcpy(string_cpy[i], strings[i]);
|
||||
strings[i] = malloc(str_size);
|
||||
string_cpy[i] = malloc(str_size);
|
||||
if (!strings[i] || !string_cpy[i]) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
exit(1);
|
||||
}
|
||||
if (fgets(strings[i], str_size, stdin)) {
|
||||
memcpy(string_cpy[i], strings[i], str_size);
|
||||
}
|
||||
}
|
||||
|
||||
// forking
|
||||
|
@ -68,5 +74,3 @@ void main () {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue