Programming Tutorials

C Tutorials

1. #if and #else in C

By: Nirmal : 2023-05-11

Description: In C, #if and #else are preprocessor directives that allow conditional compilation of code based on whether a given macro is defined or not.


2. Sum of the elements of an array in C

By: Ignatius : 2012-03-16

Description: This simple C program computes the sum of all the elements of an array.


3. Printing a simple histogram in C

By: Ignatius : 2012-03-16

Description: This simple C program prints a simple histogram.


4. Sorting an integer array in C

By: Ignatius : 2012-03-16

Description: This simple C program sorts the elements of an integer array and prints them.


5. Find square and square root for a given number in C

By: Jeffrey : 2012-03-16

Description: This simple C program shows how to find square and square root for a given number.


6. Simple arithmetic calculations in C

By: Jeffrey : 2012-03-16

Description: This simple C program shows simple arithmetic calculations.


7. Command-line arguments in C

By: Jeffrey : 2012-03-16

Description: This simple C program shows the method to accept and display command-line arguments.


8. Calculator in C

By: Emiley J : 2010-04-16

Description: This is a simple calculator written in C. To use this calculator, just type the number, followed by the operand and then by another number. The application will then display the result. After the result is displayed, the program goes into the loop which asks if they want to do another calculation. If y is pressed, another calculation can be carried out.


9. Passing double value to a function in C

By: Emiley J : 2010-04-16

Description: This sample program in C demonstrates the concept of passing a double value to a function as parameter. The program accepts a number in feet and converts the feet into meters by using a conversion function.


10. Passing pointer to a function in C

By: Emiley J : 2010-04-16

Description: This sample program in C demonstrates the concept of passing a pointer as a parameter to a function. In this program, the function "prompt" accepts two pointers. The second parameter (num) is a pointer to the variable i. Since it is a pointer, the function does not return the value. The value is stored in i itself.