im i doing this right or wrong using pointers in C
Posted
by
Amandeep Singh Dhari
on Stack Overflow
See other posts from Stack Overflow
or by Amandeep Singh Dhari
Published on 2012-10-22T22:49:48Z
Indexed on
2012/10/22
23:00 UTC
Read the original article
Hit count: 217
i like to point out that i need some help with my home work, ok the lectuer gave us the idea of a program and we have to make it from bottom to top.
- got to have user to type in two set of string.
- pointers take in the value and then puts into a prototype
- i need to make a 3rd pointer that has the value of p1 and p2.
like this p1 = asd, p2 = qwe and p3 = asdqwe
#include "stdafx.h"
#include <ctype.h>
char *mystrcat(char*s1p, char*s2p); // Prototype
char main(void)
{
char string1[80];
char string2[80];
printf("%s", "enter in your srting one ");
gets_s(string1);
printf("%s", "enter in your srting two ");
gets_s(string2);
*mystrcat(string1, string2);
return 0;
}
char *mystrcat(char *s1p,char *s2p)
{
//char *string3;
//char *string4;
//string3 = s1p;
//string4 = s2p;
printf("whatever = %s%s\n", s1p, s2p);
return 0;
}
this is the code that i made so far just need some help, thank guys in advance.
© Stack Overflow or respective owner