What will be the output of the following C code? #include #include main() { struct tm t; time_t tc; t.tm_year=2017-1900; t.tm_mday=25; t.tm_mon=5; t.tm_hour=1; t.tm_min=30; t.tm_sec=0; t.tm_isdst=0; tc=mktime(&t); printf(ctime(&tc)); } a) Sun Jun 25 01:30:00 2017 b) Sun June 25 1:30 2017 c) Sun Jun 25 1:30 117 d) Sun June 25 1:30:00 117
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
What will be the output of the following C code?
#include<stdio.h>
#include<time.h>
main()
{
struct tm t;
time_t tc;
t.tm_year=2017-1900;
t.tm_mday=25;
t.tm_mon=5;
t.tm_hour=1;
t.tm_min=30;
t.tm_sec=0;
t.tm_isdst=0;
tc=mktime(&t);
printf(ctime(&tc));
}
a) Sun Jun 25 01:30:00 2017
b) Sun June 25 1:30 2017
c) Sun Jun 25 1:30 117
d) Sun June 25 1:30:00 117
Step by step
Solved in 2 steps with 1 images