Wednesday, April 22, 2020

Structure in C

  • Flowchart :


  • Syntax :

struct [structure tag] {

   member definition;
   member definition;
   ...
   member definition;
} [one or more structure variables]; 
  • Program :

#include <stdio.h>
#include <conio.h>
struct StudentData{
    char *stu_name;
    int stu_id;
    int stu_age;
};
void main()
{
   
     struct StudentData student;
     student.stu_name = "Steve";
     student.stu_id = 1234;
     student.stu_age = 30;
     clrscr();
     printf("\n----------------STRUCTURE----------------");
     printf("Student Name is: %s", student.stu_name);
     printf("\nStudent Id is: %d", student.stu_id);
     printf("\nStudent Age is: %d", student.stu_age);
     getch();
}



  • Output :




No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...