I have a question dealing with functions and structs in the

I have a question dealing with functions and structs in the C programming language. Lets say I have a struct with the name MyStruct and then I create a function called: MyStruct *array(int i); My question is, how does the function work with the struct in regards to putting the name of the struct in front of a function? An example would be great too.

Solution

Structures:

1.It is a collection of data items of different data types under a single name.

2.structure is a heterogenous data type and more extensively utilized in C Programming language which fabricates the C Programming language uncomplicated upto defnite dimensions.

3.keyword struct declares a structure to hold the details of data feilds or data members.second element in a declaration is the tag name .this tag name is the identifier for the structure.

Syntax For structure:    struct Tagname

{

data items;

};

example: A programm to Define a structure type ,struct personal that would contain person name ,date of joining and salaree using the structure

#include<stdio.h>

#include<conio.h>

struct personal

{

char name[10];

int date;

char month;

int year;

float salary;

};

main()

{

struct personal person;

printf(\"enter the person information\");

scanf(\"%s%d%s%d%f\",person.Name,&person.date,person.month,&person.year,person.salary);

printf(\"person information is\");

printf(\"Name=%s,date=%d,month=%s,year=%d,salary=%f \",person.name,person.date,person.month,person.year,person.salary);

}

I have a question dealing with functions and structs in the C programming language. Lets say I have a struct with the name MyStruct and then I create a function

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site