*=

설명

이것은 한 변수와 다른 상수 또는 변수에 곱셈을 하는 편리한 단축이다.

문법

x *= y; // x = x * y; 와 같다.

매개변수

  • x: 변수. 허용되는 자료 형: int, float, double, byte, short, long
  • y: 변수 또는 상수. 허용되는 자료 형: int, float, double, byte, short, long

예제 코드

void setup() { Serial.begin(9600); int x = 2; x *= 3; // x 는 6 Serial.print("x = "); Serial.println(x); } void loop() { }

시리얼 모니터에 결과:

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
Arduino Uno
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Uno' on 'COM15')
New Line
9600 baud
x = 6
Ln 11, Col 1
Arduino Uno on COM15
2

ARDUINO BUY RECOMMENDATION

Arduino UNO R3
Arduino Starter Kit
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables .

※ OUR MESSAGES