Skip to main content

Brief NotesC Language: Comments, Executable Expression, and Constant

This is just my note when I attended the lecture. I write this here so it will be long lasting.  :D 

[ Comment(s) ]
In C, an expression or a sentence is ended with mark ';' (semicolon).
There are two kinds of sentence. An executable and non-executable sentence. A non-executable sentence is called a comment.
A comment is used to give some explanation to the reader (human) so our code will be possibly more understandable to human to read it. As a comment, this sentence will not be executed when our code is runned.
We can write a comment like this:


The first type is using /* */. This type can contain multiple lines. It means that everything surrounded by '/*' and '*/' mark is considered as a comment.
And second type is using //. This type can only have one line. It means that everything behind that mark, as long as it is still in the same line, it will be considered as a comment.

[ Executable Expression ]
Executable expression is, as I mentioned before, a sentence which will be executed when our code is runned. This is what we do code for.

[ Literal Constant ]
There are several types of literal constant :
Integer consists of set of number, such as: -1, 0, 3, etc.
Character consists of one or more set of character(s) surrounded by mark apostrophe ('). Ex: 'a', 'G', '#', etc.
Float consists of decimal number. Ex: 3.14, 0.5, 2.54, etc;
String is a set of characters and written surrounded by " and ". It is an array of character. Ex: "you", "harmonic convergence", etc.

Comments

Popular posts from this blog

[Arduino Project -- 5] -- Using Keypad and LCD Screen at Once to make simple Calculator

Good day. This is my fifth times of my post about Arduino. We've learned about how to create something using Arduino from the very beginning that was just make a simple push button, till we made something more difficult which was creating a temperature censor and displaying the result in the LCD screen. And now, i'm gonna show you how to use a keypad and LCD Screen at once. With these two devices are combined with our Arduino, we are able to make something like a little application. And now, i'm gonna make a simple calculator using them. Stuffs: These are stuffs you are gonna need to prepare An Arduino Uno A BreadBoard Jumper Cables A Keypad A PC which has Arduino App Installed A Potensiometer A Resistor What do we do? First thing we gotta do is to wire our Arduino and keypad as shown below: Actually we dont need the speaker and the led. But I put them when i wired them. And here is my work: It was a little bit confusing i thought. And aft

[Arduino Project-2] -- Lampu Fade in - Fade out dengan PWM

Good Day, Semoga hari-hari selalu menjadi hari baik bagi kita semua. Masih kesengsem sama Arduino, pada postingan kali ini saya akan menjelaskan (kalau bisa disebut) mempraktikan cara membuat lampu LED yang bisa nyala terang dan gelap (fade-in / fade-out ) dengan PWM. Yang akan kita lakukan adalah membuat lampu LED berubah tingkat terangnya (brightness). Sebelumnya kita perlu tahu apa itu PWM. PWM atau Pulse Width Modulation adalah teknik yang dilakukan untuk mengubah tingkat ke terang an (brightness) LED dengan cara mengatur waktu delay. Jika kita memberikan delay pada LED dengan Arduino maka lampu tersebut akan berkedip. Akan tetapi jika delay sangat cepat, maka lampu tersebut terlihat tidak berkedip lagi, melainkan kita bisa mengatur tingkat terang (brightness) lampu tersebut. Jika delay yang sangat cepat tersebut diturunkan kecepatannya sedikit, maka yang terlihat adalah brightness lampu yang turun. Begitu pula sebaliknya. Jika membingungkan, Anda tidak perlu mengingatnya. Baiklah

[Arduino Project-1] -- PushButton Lamp

Apa sih Arduino? Salam, Pada posting kali ini akan menjelaskan tentang tugas kuliah Interaksi Manusia dengan Komputer dan Antar Muka, yaitu membuat lampu push button menggunakan Arduino. Saya anggap pembaca telah mengetahui apa itu arduino. Jika belum tahu, akan saya jelaskan sedikit. Arduino bisa dikatakan sebagai alat untuk membuat sebuah prototye. Kita bisa  membuat apapun (hampir apapun) dengan menggunakan arduino. Seperti membuat sensor panas/dingin,bahkan hingga membuat robot. Arduino sebenarnya diperuntukkan bagi para artist maupun designer yang memerlukan kemudahan dalam merancang produk yang hendak mereka buat. Jadi, untuk menggunakannya tidak diperlukan keterampilan khusus yang tinggi karena di design untuk kemudahan (tentunya setelah tahu dasar-dasarnya). Seperti apa sih Arduino itu? Di bawah ini gambarnya Image Source: https://dlnmh9ip6v2uc.cloudfront.net//images/products/1/1/0/2/1/11021-01a.jpg Arduino ada banyak jenisnya yang bisa dilihat di