C
Chad
I'm want
static char *output[BUFF];
to hold the modified string "tel chad"
However, when I debug it,
static char *output[BUFF]
holds the ascii value of the strng, and not the string itself.
Here is what I have. I know gets(), strcat strcpy() shouldn't be used.
I just wrote the program to isolate the problem I'm having.
#include <stdio.h>
#include <stdlib.h>
#define BUFF 20
int main(void) {
char name[BUFF];
static char *output[BUFF];
int count = 2;
char tel[] = "tel ";
char *msg_list[] = {" apple", " orange", " grape" };
printf("Enter the target persons username \n");
gets(name);
/* tel = "tel chad"*/
strcat(tel,name);
printf("%s \n", tel);
strcpy(&output[1], tel);
/*strcat(tel,msg_list[1]);*/
/* printf("%s \n", output[1]);*/
return 0;
}
static char *output[BUFF];
to hold the modified string "tel chad"
However, when I debug it,
static char *output[BUFF]
holds the ascii value of the strng, and not the string itself.
Here is what I have. I know gets(), strcat strcpy() shouldn't be used.
I just wrote the program to isolate the problem I'm having.
#include <stdio.h>
#include <stdlib.h>
#define BUFF 20
int main(void) {
char name[BUFF];
static char *output[BUFF];
int count = 2;
char tel[] = "tel ";
char *msg_list[] = {" apple", " orange", " grape" };
printf("Enter the target persons username \n");
gets(name);
/* tel = "tel chad"*/
strcat(tel,name);
printf("%s \n", tel);
strcpy(&output[1], tel);
/*strcat(tel,msg_list[1]);*/
/* printf("%s \n", output[1]);*/
return 0;
}