|
|
| Programs and Data Structures in C: Based on ANSI C and C++, 2nd Edition (ISBN: 0471931233) |
 |
List Price: $80.00
Our Price: $80.00
Used Price: $71.19
Release Date: 05 March, 1992
Manufacturer: John Wiley & Sons (Paperback)
Sales Rank: 550,049
Author: Leendert Ammeraal
|
More Info
|
|
|
Simple Struct Example
|
2002-02-23 16:21:58
|
| |
c
|
|
|
|
|
Category: source:c:structures
|
|
Description: Basic example of using a data structure to store variables.
|
|
Platform: unix/win
|
|
Author: mind
|
|
Viewed: 10243
|
|
Rating: 3.2/5 (71 votes)
|
|
|
| If you have any questions about
this piece of code or still need help, try posting your question on the forum. |
/* struct example by mind@metalshell.com
*
* This is a simple example on structures, I based this on website hits.
*
* 02/19/2002
*
* http://www.metalshell.com
*
*/
#include <stdio.h>
struct hits
{
int totalHits;
int dailyHits;
} nullhosting, metalshell;
int main()
{
nullhosting.totalHits = 1000;
nullhosting.dailyHits = 10;
metalshell.totalHits = 3000;
metalshell.dailyHits = 100;
/* print metalshell's hits */
printf("Metalshell.com's Stats:\n");
printf("Total hits: %i Daily hits: %i\n\n", metalshell.totalHits, metalshell.dailyHits);
/* print nullhosting's hits */
printf("Nullhosting.com's Stats:\n");
printf("Total hits: %i Daily Hits: %i\n", nullhosting.totalHits, nullhosting.dailyHits);
return 0;
}
|
|
|