Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 Point out the error in the program? #include<stdio.h> int main() { struct emp { char name[25]; int age; float bs; }; struct emp e; e.name = "Suresh"; e.age = 25; printf("%s %d\n", e.name, e.age); return 0; } ?->(Show Answer!)
1. Point out the error in the program? #include<stdio.h> int main() { struct emp { char name[25]; int age; float bs; }; struct emp e; e.name = "Suresh"; e.age = 25; printf("%s %d\n", e.name, e.age); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.02 pm
We cannot assign a string to a struct variable like e.name = "Suresh"; in C. We have to use strcpy(char *dest, const char *source) function to assign a string.
Ex: strcpy(e.name, "Suresh");