Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

In where we should use void

0 votes
asked Dec 3, 2020 by T20P325_Arun CSE_C (120 points)

4 Answers

+1 vote
answered Dec 4, 2020 by Narendran Karthikeyan (210 points)
I am assuming that you are talking about the void function type or a pointer type. The void function type is usually used when you want the function to do a process and not really return anything. And void function type is used so that the pointer can be used to point to any variable. So, you may use it if you are not sure what you want the pointer to point towards. Hope this answers your question.
0 votes
answered Dec 5, 2020 by Abhinav Sai (140 points)
we should void in starting of the program and it is main function also
0 votes
answered Dec 6, 2020 by M Awais Akbar (140 points)
When we work on Function we declare function first in which initially we describe return type if we don't want to return then we use void. e.g

void myarr(){

};

in this function first we type return that is void then function name then its parameter and in last statement.
0 votes
answered Dec 7, 2020 by Zakaria Aboujenane (140 points)
supposing that we want to calculate the sum of two integers , a and b , so we need to give a and b and receive the integer value of  (a+b) in this case the type of return is int.

What about Void ?

if we don't need any value from the function, for example , we just want the function to print something for as.

 for example we have an array of numbers and we just need a function to print the array .so she will just print the array and stop without returning any value . then the type here shoulf be void .
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...