C Programming Tips by Philip Guo
Philips Guo at Stranford University has useful collection of C programming lessons which may be quite useful if you are […]
Philips Guo at Stranford University has useful collection of C programming lessons which may be quite useful if you are […]
This is a small C language program that can read a text file. The program is given file name as command parameter and it reads the file line by line. The program will prints out number of characters and words in each line.
This is a C program to implement Library Management System by which a librarian can operate a simple library. It uses Linked List, Stack and Pointers to implement different features of the library system. The program also uses struct data structure to add records in the library.
This C program is designed to compute the factorial of a user-entered integer. The program employs a for loop to calculate the factorial and then displays the result. The user can continue inputting positive integers to obtain their factorials until a non-integer input is provided which terminates the program.
The C program is an implementation of the 8-Queens Puzzle, a classic problem in chess. The objective of the puzzle is to place eight chess queens on an 8×8 chessboard in such a way that no two queens threaten each other. In chess, a queen can attack horizontally, vertically, and diagonally.
A union in C programming is a user defined data type which may hold members of different sizes and type. Union uses a single memory location to hold more than one variables. However, only one of its members can be accessed at a time and all other members will contain garbage values. A structure is a convenient tool for handling a group of logically related data items. Structure help to organize complex data is a more meaningful way. It is powerful concept that we may after need to use in our program Design.
C language provides a standard and minimal set of basic data types. Sometimes these are called primitive data types. More complex data structures can be built up from these basic data types. Data types specify how we enter data into our C programs and what type of data we use for different operations. C has some predefined set of data types to handle various kinds of data that we can use in our program.
This C program is a simple console-based implementation of a number-shuffling game. The game presents a grid of numbers, and the objective is to rearrange them in ascending order. The player can move the numbers by pressing the corresponding number keys, and the game tracks the number of moves taken to complete the puzzle.
This C program simulates the game “snake” which is usually available in old mobile phones. A string of characters moves on the screen according to arrow keys pressed by user. If it touches itself or screen boundary, the program terminates. When the snake moves, in arbitrary screen positions some digit (1-9) appears. The objective of the game is to make the snake eat the said digit, so that it is added to the score. When a digit is eaten, the size of the snake increases by the number of characters equal to the value of the digit.