[C] How to pass string to another function
#include <stdio.h>
#include <string.h>
int print(char *src )
{
char dest[100];
memset(dest, '\0', sizeof(dest));
strcpy(dest, src);
printf("Final copied string : %s\n", dest);
return 1;
}
int main()
{
char src[40];
strcpy(src, "This is tutorialspoint.com");
print(src);
return(0);
}
Reference:
2014年4月14日 星期一
訂閱:
張貼留言 (Atom)
0 意見:
張貼留言