전역변수 값 전달

2024. 6. 22. 21:36정보처리,전산/Clang

반응형
#include <stdio.h>
#include <string.h>

int result =10; //전역변수
int mul(int a, int b){
  int result;
  result =a *b;
  return result;
  
}
void main(){
  mul(5,6);
  printf("%d",result);
}

 

#include <stdio.h>
#include <string.h>

int result =10; //전역변수
int mul(int a, int b){
  int result;
  result =a *b;
  return result;
  
}
void main(){
  result=mul(5,6);
  printf("%d",result);
}

반응형

'정보처리,전산 > Clang' 카테고리의 다른 글

문자열 변환 출력  (0) 2024.06.29
주소 배열 출력  (0) 2024.06.26
비트연산  (0) 2024.06.22
call by reference  (0) 2024.06.16
랜덤 숫자 발생 후 입력 값 존재 유무 찾기  (0) 2024.05.29