I don't understand what is wrong with the following code. Please help.#include <stdio.h>#include <string.h>struct employee{ char name[100]; char address[100]; char desgn[100]; float salary;};int main(){ struct employee details; printf("Please enter the full name of the employee : "); scanf("%[^\n]s", details.name); printf("\n"); printf("Please enter the address of the employee : "); scanf("%[^\n]s", details.address); printf("\n"); printf("Please enter the designation of the employee : "); scanf("%[^\n]s", details.desgn); printf("\n"); printf("Please enter the salary of the employee : "); scanf("%f", details.salary); printf("\n"); printf("\n"); printf("PAY SLIP"); printf("This is to certify that Mr/Ms. %s ,who lives at %s, works in our company as the %s. He receives %f only, as salary per month.", details.name, details.address, details.desgn, details.salary); return 0;}
I have two doubts in the program.1.Is there any reason to write the int main() function after a few lines in this particular program, but to write the same immediately after the include <stdio.h> line in most other programs?2. Why is there a semicolon after the curly bracket before int main() function?
498 visits
Outline:ଷ୍ଟ୍ରକଚର୍ସ ସହିତ କାର୍ଯ୍ୟ -ପରିଚୟ -ଷ୍ଟ୍ରକଚର୍ସର ସିଣ୍ଟାକ୍ସ -Declaration ଏବଂ initialization - ଷ୍ଟ୍ରକଚର୍ ଭେରିଏବଲ୍ ର Declaration -ଷ୍ଟ୍ରକଚର୍ ଭେରିଏବଲ୍ ଆକ୍ସେସ୍ କରିବା
ଷ୍ଟ୍ରକଚର୍ସ ସହିତ କାର୍ଯ୍ୟ -ପରିଚୟ -ଷ୍ଟ୍ରକଚର୍ସର ସିଣ୍ଟାକ୍ସ -Declaration ଏବଂ initialization - ଷ୍ଟ୍ରକଚର୍ ଭେରିଏବଲ୍ ର Declaration -ଷ୍ଟ୍ରକଚର୍ ଭେରିଏବଲ୍ ଆକ୍ସେସ୍ କରିବା
Show video info
Pre-requisite