How to return nothing from a void function to stop running the function in C

1 Answer

0 votes
#include <stdio.h>

void info(const char *message)
{
  if (NULL == message)
  {
    return; // return nothing, skip the code below, stop running the function
  }

  fprintf(stderr, "%s:%d %s\n", __FILE__, __LINE__, message);
}
int main(void)
{
    info(NULL);
    
    return 0;
}

   
/*
run:
 

*/

 



answered Aug 31, 2017 by avibootz

Related questions

1 answer 159 views
159 views asked Dec 4, 2016 by avibootz
1 answer 132 views
1 answer 101 views
1 answer 109 views
109 views asked May 30, 2023 by avibootz
2 answers 126 views
126 views asked May 12, 2023 by avibootz
...