?? fprime.c
字號:
/* * file: fprime.c * This program calculates prime numbers */#include <stdio.h>#include <stdlib.h>#include "cdecl.h"/* * function find_primes * finds the indicated number of primes * Parameters: * a - array to hold primes * n - how many primes to find */extern void PRE_CDECL find_primes( int * a, unsigned n ) POST_CDECL;int main(){ int status; unsigned i; unsigned max; int * a; printf("How many primes do you wish to find? "); scanf("%u", &max); a = calloc( sizeof(int), max); if ( a ) { find_primes(a,max); /* * print out the last 20 primes found */ for(i= ( max > 20 ) ? max - 20 : 0; i < max; i++ ) printf("%3d %d\n", i+1, a[i]); free(a); status = 0; } else { fprintf(stderr, "Can not create array of %u ints\n", max); status = 1; } return status;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -