The GNU Compiler Collection includes front ends for C, C++,
Objective-C, Fortran, Ada, Go, and D, as well as libraries for these
languages (libstdc++,...). GCC was originally written as the compiler
for the GNU operating system.
#include <stdio.h>
#define IN 1 /* inside a word */
#define OUT 0 /* outside a word */
int main()
{
int c, nl, nw, nc, state;
state = OUT;
nl = nw = nc = 0;
while ((c = getchar()) != EOF) {
++nc;
if (c == '\n')
++nl;
if (c == ' ' || c == '\n' || c == '\t')
state = OUT;
else if (state == OUT) {
state = IN;
++nw;
}
}
printf("Lines: %d, Words: %d, Chars: %d\n", nl, nw, nc);
return 0;
}
#define ARRAY_LENGHT 10
int main() {
int i, tmp, arr[ARRAY_LENGHT];
srand(time(NULL));
for (i = 0; i < ARRAY_LENGHT; i++) {
arr[i] = rand() % 100;
}
for (i = 0; i < ARRAY_LENGHT/2; i++) {
tmp = arr[i];
arr[i] = arr[ARRAY_LENGHT - i - 1];
arr[ARRAY_LENGHT - i - 1] = tmp;
}
}