C_简单的子函数调用
源码:
# include <stdio.h>
/* 子函数声明 */
int square(int x); // 实现求平方值的子函数
int cube(int y); // 实现求立方值的子函数
int main()
{
int m = 12;
int n = 4;
printf("%d %d\n", square(m), m);
printf("%d %d\n", cube(n), n);
return 0;
}
int square(int x)
{
x = x*x;
return x;
}
int cube(int y)
{
y = y*y*y;
return y;
}
相关文档:
源码:
# include <stdio.h>
int main()
{
/* 定义变量并赋初值 */
int a = 5;
char c = 'a'; // 'a'的ASC码的值为97
  ......
源码:
# include <stdio.h>
int main()
{
/* 定义字符型变量,并给它们付初值 */
char c1, c2, c3, c4, c5, c6, c7;
c1 = 'C';
c2 = 'h';
c3 = 'i';
c4 = 'n';
& ......
源码:
# include <stdio.h>
int main()
{
int i, j, k;
/* 变量i从0到4,表示所画菱形图的第一至第五行 */
for(i = 0; i <= 4; i++)
{
/* ......
源码:
# include <stdio.h>
int main()
{
int array[16][16];
int i, j, k, m, n;
/* 变量初始化 */
m = 1;
while(m == 1)
{
  ......
源码:
/* 学生成绩查询系统 */
# include <stdio.h>
# include <stdlib.h>
int main( )
{
int select;
int i, j;
int score[5][7];
int average = 0;
int sum = 0;
&n ......