Category Archives: Function

Problem 85: Product

Create a structure named Product with following two fields-

1. name (string)
2. price (double)

Then create a function named printProductInfo() which takes a parameter of Product type and print the information of that Product. Finally, in main function create a variable of structure Product named myProduct and call the printProductInfo() function passing myProduct as the parameter.


Struct Problem 1: 101cproblems

Problem 81: Struct GPA

Create a simple structure named Student that holds the following variables-
i. id (integer)
ii. cgpa (float)
iii. name (string)
Now create an instance of that structure named s1 and scan the values from the user. Finally print the id, cgpa and name which user entered.



Another approach:


Typedef Enum Union Project



Using function with Struct user defined type also pointer


why we used *sp in one place and sp in another place ?there s a reason behind this
*sp means address is passing where after the local input takeup it will go but if not use  dereferencing then it will not go outside. So to write we need with address.

and in sp it is read only. so to print sp is enough to show.


Send Array to Function Using Pointer



Return More Than one Value in a Function

In function we can’t retun more than one value with return keyword. In this case we need pointer to return more variables than one in function.





Value: Absolute in Function



USD to BDT function in C



Find Max Value From 3 Parameters Using Function


Another Logic by me:

Another Logic that is good:

A very very good logic: (Logic Logic)


Function Calculator


With Switch Case:

Another easy code:


Function Divisor



This formula link will help you to think about the logic.

Got this problem from

Recursion Example



Void clear in C

We  see lots of void in C. Lets clear why we all use  this.

it means  it will return int type value but will not take any is also good to define in function prototype

it means it will return int type value but will take parameters that is defined:

it means it will return nothing and if we use return here it will show error as void can’t return a value

but we can return from a condition here is one example:


but if we use return value with int return type it will return 1 as true returning.
example could be written as:

Source: Took some help:

Returning From Array Function in C

As I am learning I didn’t find the solution yet when I was trying to make a reusable code for mydigit extracts code to make it functinal.

So here is the code I tried but it’s not working;


Solution can be foound from this link:

Find Is It Armstrong Number or Not

code by me:

Logic and Code From the Vids: