c - using function to print two variables -
the function seems not work, correct form when print variable(string)
in function?
void f1(char ara, char arb) { printf("acronym found:\n %s - %s\n", ara, arb); } int main(void) { char arc[20],ar1[] = "afaik",ard1[] = "as far know"; printf("welcome internet system\nenter \"quit\" exit program\n"); { printf("enter string: "); scanf("%s", &arc); if (strcmp(arc, ar1) == 0) f1(ar1, ard1); .......
just change type of arguments in f1 pointer variable.
void f1(char *ara, char *arb)
because while giving char take 1 character has 1 byte store character.
when convert character pointer, have 4 bytes store string.
Comments
Post a Comment