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;
}
相关文档:
C/C++中的Split函数是strtok()其函数原型如下:
char * strtok (char * str, const char * delimiters);
函数说明
strtok()用来将字符串分割成一个个片段。参数str指向欲分割的字符串,参数delimiters则为分割字符串,当strtok()在参数
str的字符串中发现到参数delimiters的分割字符时则会将该字符改为'\0'字符 ......
源码:
# include <stdio.h>
int main()
{
int i, j, k;
int m, n, p;
i = 8;
j = 10;
k = 12;
/* 自增在操作数之前 */
  ......
源码:
# 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 num;
/* 下面定义的各变量,分别代表个位,十位,百位,千位,万位,十万位以及位数 */
int indiv, ten, hundred, thousand;
int ten_thousand, hundred_thous ......
源码:
# include <stdio.h>
/* 宏定义 */
# define MAX 100
# define LEN 80
/* 一个非常简单的文本编辑器 */
int main()
{
char text[MAX][LEN]; // 定义字符型数组
register int t, i, j; /* 定义三个寄存器变量 */
  ......