I was planning on learning C++ next, so I guess if I can get along with the C++ compiler I'm that much closer to being finished with this initial training.
You are right about 'gets'. I was aiming for simplicity at that point.
The following works, but I would like to allocate a specific amount of memory for the appended string.
main()
{
/*get two strings*/
char *a, *b;
printf ("\nEnter two strings of characters separated by a space: ");
scanf ("%s%s", a, b);
a = strcat (a, b);
printf...
Help a newbie out with this program:
input--two strings from the user
output--one string with memory allocated.
for example: first and last name.
Here is my code--I'm obviously confused.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char add_strings (char *, char *);
char...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.