C语言形式参数(形参)

#include <stdio.h>

/* global variable declaration */
int a = 20;

int main () {

  /* local variable declaration in main function */
  int a = 10;
  int b = 20;
  int c = 0;

  printf ("value of a in main() = %d/n",  a);
  c = sum( a, b);
  printf ("value of c in main() = %d/n",  c);

  return 0;
}

/* function to add two integers */
int sum(int a, int b) {

   printf ("value of a in sum() = %d/n",  a);
   printf ("value of b in sum() = %d/n",  b);

   return a + b;
}

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265138.html

(0)
上一篇 2022年6月7日
下一篇 2022年6月7日

相关推荐

发表回复

登录后才能评论