Computer Science, asked by TbiaSupreme, 1 year ago

Define the structure of a function?

Answers

Answered by hukam0685
1
Hi,

Note:

Structure and function are two different terms in C language.Question should be like that Define Syntax of a function.

Syntax of function:
➖➖➖➖➖➖➖

______________________________

Return_Type Function _Name (argument list)

{

Set of statements-- used for specific task;

}
_______________________________

Explanation:
_________

Return_Type:
******************
Data type which the function returns,it can be int,float,double,char etc

Function Name:
*********************

It can be any identifier written by programmer in user defined function,it is better to give a logical name

Argument list:
*******************
Argument list includes the input variable and data type of input variable.

Set of statements:
************************
Function body includes sequence of logical statement which can be written to perform a specific task.

For eg: Sum of two variables

#include<stdio.h>

int SUM(int a,int b)
{
int C;
C= a+b;
return c;
}

Hope it helps you.
Answered by swagg0
4
HEY MATE ⭐⭐⭐
HERE IS THE ANSWER ✌
_________________

Structure is a user-defined data type in C language which allows us to combine data of different types together.
Structure helps to construct a complex data type which is more meaningful. It is somewhat similar to an Array, but an array holds data of similar type only.
But structure on the other hand, can store data of any type, which is practical more useful.

For example:
to write a program to store Student information, which will have Student's name, age, branch, permanent address, father's name etc, which included string values, integer values etc.

In structure, data is stored in form of records.

Example of Structure:

struct Student
{
char name[25];
int age;
char branch[10];
// F for female and M for male
char gender;
};


Here struct Student declares a structure to hold the details of a student which consists of 4 data fields, namely name, age, branch and gender. These fields are called structure elements or members.

Each member can have different datatype, like in this case, name is an array of char type and age is of int type etc. Student is the name of the structure and is called as the structure tag.

✔✔✔✔✔✔✔

Similar questions