Calculate program execute time / time elapsed in C

Here i shared a simple method to calculate program execute time or time elapsed in C /*calculate program execute time */ #include #include int main(int argc, char *argv[]) { time_t start, stop; clock_t ticks; long count; time(&start); // Do stuff int i=0; while(i

How to handle unknow size user input in C

Here are two examples to handle user input in C. 1. scanf This method is easy get attack by buffer overflow, try input some characters which are more than what you declare to experience about what is buffer overflow. #include #include int main() { char bStr[80]; printf(“\nEnter a very very very long String value:”); scanf(“%s”, …

Read more