Skip to main content

Posts

Rules and PSPC Term-works List for ESE Lab

Please find the term-works list and Rules for conduction of PSPC ESE Lab below:
Recent posts

IA-2 PSPC Syllabus

Following is the syllabus for PSPC IA-2: Decision Making and Looping ( includes nested loops also ) Introduction The while statement The do statement The for statement Jumps in Loops Arrays ( 1D arrays only ) Introduction One-dimensional arrays Initialization of one-dimensional arrays NOTE: Programs on above the above mentioned topics can be asked in IA-2. Hence thoroughly practice the programs discussed in the class and also the problems given during the regular labs. Also refer the chapters: 5 & 6 from the prescribed text book " Programming in ANSI C " by E.Balagurusamy. All the best for IA-2!!!

Using time() functions in C programs to calculate time taken to execute set of statements

Following is the procedure to use time() functions in C. These functions help us to calculate total time taken (in seconds) to execute a set of statements. This is very helpful if we are testing the efficiency of any algorithm / methodology: Include time.h header in your C program. i.e., write #include<time.h> statement before main() function. Inside main(), define two variables t1 and t2 whose data type is time_t. i.e, write time_t t1, t2; t1 is used to record initial time (in seconds) and t2 is used to record elapsed time (in seconds) Use t1=time(NULL); before the start of the algorithm/ methodology that you want to test. After writing algorithm/ methodology, use t2=time(NULL);   Total time taken can now be calculated as: t2-t1. Following sample example shows the usage of time() functions in C programs: #include<stdio.h> #include<time.h> main() {         time_t t1, t2;         int flag=0; ...