My exposure to arrays and pointers are bit limited. And concatened strings even less ( it was not covered in my class so I had to google it. ) So I know there are errors. I can not use any of C string libary functions. Thoughts?

#include <stdio.h>

char *strcat385(char string1[ ], char string2[ ]) {
int i = 0;


string1[i] = str[i];




string1[i] = strign2[];


string1 [i] = '\0';


int main( ) {
  char str[50] = "CSC course 385 ",
       str2[ ] = "sections 701, 710";
  printf("The return from strcat373:\n%s\n", strcat(str, str2));
  printf("string1 is %s\nstring2 is %s\n", str, str2);
8 Years
Discussion Span
Last Post by iamthwee

1. Use code tag correctly:
[code=c] source


2. Have you ever heard that all names must be declared before used in C? If not, take your textbook again. If yes, what's str (or str2) in strcat385 body?

3. What's an index of string2 element in string1[i] = strign2[]; ? Can you explain what is it: while(str2[]) ?

4. I see that strcat385 must return a pointer. Where is return statement in this function body?

It's hard to say that absolutely senseless and untidy text demonstrates your efforts...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.