Thread: Function retrun type and param list

  1. #1
    Registered User
    Join Date
    Oct 2020

    Function retrun type and param list

    1.​It seems like at least for writting code for microcontroller eval boards that unlike assembler C does not do well with just listing rows and rows of code in "main.c" Seems like functions are the way to go which actually is better and makes a program way esier to read. So if i have a function that calls other functions that do a task like output to a port and they are not returning any results to the calling function for that calling function ,probably a while , do i just put void calling function <void> or do i need a return type calling function <parameter list> ?

    2.I have another question, if i create a while and it is while(1) will the while keep executing ? so the code would stop, forever executing the while(1) any statements or functions below the {} of the while(1) would not be executed?
    Last edited by OutThere; 10-18-2020 at 10:37 AM. Reason: change

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    1. If the function is not meant to return a value then declare it to have void return type.

    2. Yes.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 03-23-2016, 09:46 AM
  2. creating a list pointer of parent type from base type...
    By Adamkromm in forum C++ Programming
    Replies: 14
    Last Post: 04-14-2012, 02:07 PM
  3. & vs * in param list?
    By homer_3 in forum C++ Programming
    Replies: 4
    Last Post: 06-17-2011, 05:30 PM
  4. Replies: 3
    Last Post: 02-18-2008, 10:52 AM
  5. A retrun card problem
    By joenching in forum C++ Programming
    Replies: 8
    Last Post: 05-08-2005, 01:01 PM

Tags for this Thread