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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -