NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

ชนิดของข้อมูล
ภาษาซีเป็นอีกภาษาหนึ่งที่มีชนิดของข้อมูลให้ใช้งานหลายอย่างด้วยกัน ซึ่งชนิดของข้อมูลแต่ละอย่างมีขนาดเนื้อที่ที่ใช้ในหน่วยความจำที่แตกต่างกัน และเนื่องจากการที่มีขนาดที่แตกต่างกันไป ดังนั้นในการเลือกใช้งานประเภทข้อมูลก็ควรจะคำนึงถึงความจำเป็นในการใช้งานด้วย สำหรับประเภทของข้อมูลมีดังนี้คือ

1. ข้อมูลชนิดตัวอักษร (Character) คือข้อมูลที่เป็นรหัสแทนตัวอักษรหรือค่าจำนวนเต็มได้แก่ ตัวอักษร ตัวเลข และกลุ่มตัวอักขระพิเศษใช้พื้นที่ในการเก็บข้อมูล 1 ไบต์
2. ข้อมูลชนิดจำนวนเต็ม (Integer) คือข้อมูลที่เป็นเลขจำนวนเต็ม ได้แก่ จำนวนเต็มบวก จำนวนเต็มลบ ศูนย์ ใช้พื้นที่ในการเก็บ 2 ไบต์
3. ข้อมูลชนิดจำนวนเต็มที่มีขนาด 2 เท่า (Long Integer) คือข้อมูลที่มีเลขเป็นจำนวนเต็ม ใช้พื้นที่ 4 ไบต์
4. ข้อมูลชนิดเลขทศนิยม (Float) คือข้อมูลที่เป็นเลขทศนิยม ขนาด 4 ไบต์
5. ข้อมูลชนิดเลขทศนิยมอย่างละเอียด (Double)
หลักการตั้งชื่อตัวแปร

ในการประกาศสร้างตัวแปรต้องมีการกำหนดชื่อ ซึ่งชื่อนั้นไม่ใช่ว่าจะตั้งให้สื่อความหมายถึงข้อมูลที่เก็บอย่างเดียว โดยไม่คำนึงถึงอย่างอื่น เนื่องจากภาษา C มีข้อกำหนดในการตั้งชื่อตัวแปรเอาไว้ แล้วถ้าตั้งชื่อผิดหลักการเหล่านี้ โปรแกรมจะไม่สามารถทำงานได้ หลักการตั้งชื่อตัวแปรในภาษา C แสดงไว้ดังนี้

1.
ต้องขึ้นต้นด้วยตัวอักษร A-Z หรือ a-z หรือเครื่องหมาย _(Underscore) เท่านั้น
2.
ภายในชื่อตัวแปรสามารถใช้ตัวอักษร A-Z หรือ a-z หรือตัวเลข0-9 หรือเครื่องหมาย _
3.
ภายในชื่อห้ามเว้นชื่องว่าง หรือใช้สัญลักษณ์นอกเหนือจากข้อ 2
4.
ตัวอักษรเลขหรือใหญ่มีความหมายแตกต่างกัน
5.
ห้ามตั้งชื่อซ้ำกับคำสงวน (Reserved Word)
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.