Posts

Showing posts from August, 2020

C program to initializing structure variables directly and accessing them

Image
 // initializing structure varibles directly and accessing them #include <stdio.h> struct emp {     int eno;     char ename[20];     float sal; }; int main() {     struct emp e = {1001,"Rajni", 50000}; /*assign values in the same order in which variables are declared*/     printf("Employee details:\n ");       printf("E.No: %d\n EName: %s\n Salary: %f\n",e.eno,e.ename,e.sal);          return 0; } OUTPUT: