Skip to content

Instantly share code, notes, and snippets.

// 变量的作用域
#include <stdio.h>
int count; // this is a global variable
void head1();
void head2();
void head3();
// 用递归法计算n!
#include <stdio.h>
long factorial (int n)
{
long f;
if(n <= 1) f = 1;
else f = n * factorial(n - 1);
return(f);
// 根据用户掷色子的值,显示相应个数的星号*
#include <stdio.h>
void showone ();
void showtwo ();
void showthree ();
void showfour ();
void showfive ();
void showsix (); // 色子数为1~6的情况分别以星号表示
int randn(); //随机摇出色子点数
@novnan
novnan / gist.c
Last active January 1, 2016 10:19
/* 有10个整数组成一个数组a,其中整数x出现了若干次,删除多余的x
只保留一个x,显示删除了的x的个数和最后的数组a */
//假如要删除1
#include <stdio.h>
#define N 100
void main()
{
int x, i, count = 0;
int a[10] = {5, 1, 2, 1, 1, 4, 3, 1, 1, 6};
{
"cmd": ["gcc", "${file}", "-o", "${file_path}/${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",