1.函数概念理解例题一个求和函数#include <stdio.h> int Add(int x,int y) { int z =0; z = x+y; return z; } int main() { int a =10; int b =20; int sum = Add(a,b); printf("%d\n",sum);
1.计算n的阶乘#include <stdio.h> int main () { int i=0; int n=0; int ret=1; scanf("%d",&n); for (i=1; i <=n; i++) { ret=ret*i; /* code */ } printf("ret=%d\n",ret);
#include <stdio.h>int main(){ int a = 10;//申请了四个字节的空间 //printf("%p\n",&a); int *p = &a ;//p是一个变量-指针变量 //printf("%\n",p); *p = 20;//*-解引用操作符/间接访问操作符 pr
没有static时#include <stdio.h>void test(){ int a = 1; a++; printf ("a=%d\n",a);}int main(){ int i=0; while (i<5) { test (); i++;&nbs
#include <stdio.h>int Max(int x,int y){ if (x>y) return x; else return y;}int main() { int num1=10; int num2=20; int max=0; max=Max(num1,num2);
#include <stdio.h>int main() { char arr1[]="abc"; printf ("%s\n",arr1); return 0;}
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号