Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. fitzov

    linking strings

    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.
  2. fitzov

    linking strings

    The following works: #include <stdio.h> #include <string.h> #include <stdlib.h> main() { /*allocate memory for two strings*/ char *f_string = (char *)malloc(sizeof(char) * 100); char *l_string = (char *)malloc(sizeof(char) * 50); if (f_string == NULL || l_string == NULL)...
  3. fitzov

    linking strings

    The following works: #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { char *f_string, *l_string; /*allocate memory for both strings*/ f_string = (char *)malloc(sizeof (256)); l_string = (char *)malloc(sizeof (128)); /*get two strings*/...
  4. fitzov

    linking strings

    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...
  5. fitzov

    linking strings

    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...

Part and Inventory Search

Back
Top