I wrote this program that show result with scanning address of variable (scanf("%s", &name))
Enter a Name of candidateCode:#include <stdio.h> int main() { char name[100]; printf("Enter a Name of candidate \n"); scanf("%s", &name); printf("Name of candidate is %s\n",name); return 0; }
Dev
Name of candidate is Dev
again I wrote program without & (scanf("%s", name))
Enter a Name of candidateCode:#include <stdio.h> int main() { char name[100]; printf("Enter a Name of candidate \n"); scanf("%s", name); printf("Name of candidate is %s\n",name); return 0; }
Dev
Name of candidate is Dev
when we write scanf in c program we should always write (&) in program. My second program is not correct but why it show the result.