hi , i'm writing a user define function for time i don't know is it correct.. need help

here are my code

void Time(char buffer[256],   time_t curtime , struct tm *loctime)
	  {
		 curtime = time (NULL);

		 loctime = localtime (&curtime);

		 fputs (asctime (loctime), stdout);

		 strftime (buffer, 256, "Today is %A, %B %d.\n", loctime);
		 fputs (buffer, stdout);
		 strftime (buffer, 256, "The time is %I:%M %p.\n", loctime);
		 fputs (buffer, stdout);

		 return 0;
	  }

>> i don't know is it correct
Compile and test it and find out if its correct or not.


1. There is no need for the second and third parameters to that function and possibly not even the first parameter. You can make all those parameters local to that function because the calling function will not be able to see them.

2. Delete the return 0 last line because void functions to not return anything.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.