Some Tips
Some Tips
Some Tips
Unportable Code:
1- implementation-defined— The compiler-writer chooses what happens, and has to document
it.
Example: whether the sign bit is propagated, when shifting an int right.
2- unspecified— The behavior for something correct, on which the standard does not impose
any
requirements.
Example: the order of argument evaluation.
For instance, in c(a(), b()); it is unspecified whether the function a is called before or after b. The
only guarantee is that both are called before the c function.
undefined— The behavior for something incorrect, on which the standard does not impose any
requirements. Anything is allowed to happen, from nothing, to a warning message to program
termination, to CPU meltdown, to launching nuclear missiles (assuming you have the correct
hardware option installed).
Example: what happens when a signed integer overflows.
a+++b >>>>> a++ + b ; c--> 0 >>>>> c-- > 0 (greedy algorithm for tokenization in lexical
analysis stage)
eulerian path: if all nodes are of even degree , but the start and the end are odd
eulerian tour: special case, where the starting node is also the end node , so all nodes can have
even degree
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
void time_fun(void );
void int_prom(void );
int int_sum(int , int );
void swap_func(int ,int);
void set_bit( int );
void reset_bit(int );
int main()
{
reset_bit(3);
return 0;
}
void time_fun(void )
{
time_t max_time = INT_MAX;
time_t current_time, diff_time;
char * current, *maximum, *diff;
current_time = time(NULL);
current = ctime((const time_t *)¤t_time);
printf("current time is %s\n",current);