2022-10-17 01:32:17
/* %d -- 列印整型 %c -- 列印字符 %f -- 列印浮點數字 - 小數 %p -- 以地址的方式列印 %x -- 列印16進制數字 %lf--列印雙精度浮點數 */ #include <stdio.h> int main() { //extern:宣告外部符號 extern int g_val; printf("g_val =%d\n", g_val); return 0; } /* int main() { //計算2個數的和 int num1 = 0; int num2 = 0; int sum = 0; //輸入資料-使用輸入函式scanf_s scanf_s("%d%d", &num1, &num2);//&取地址符號 //C語言語法規定:變數要定義在當前代碼的最前面 sum = num1 + num2; printf("sum = %d\n",sum); return 0; } */ //int a = 5; //int main() //{ // printf("%d\n", a); // return 0; //} //(---------------------) //int a = 20; // //int main() //{ // //int a = 5; // printf ("%d\n", a); // return 0; //} //(----------------------------------------------------------------) //int main() //{ // //年齡 // //18 // short age = 18;//向記憶體申請2個位元組=18bit,用來保存18 // float weight = 72.5f;//向記憶體申請4個位元組=32bit,存放小數 // return 0; //} //(----------------------------------------------------------------) /* int main() { printf("%d\n", char(sizeof(char))); //1個位元組8個位元位 范圍:2^8-1 = 255 printf("%d\n", short(sizeof(short))); //2個位元組16個位元位 范圍:2^16-1 = 65535 printf("%d\n", int(sizeof (int))); //4個位元組32個位元位 范圍:2^32-1 = 4294967295 printf("%d\n", long(sizeof(long))); //4個位元組32個位元位 范圍:2^32-1 = 4294967295 printf("%lld\n", long long(sizeof(long long))); //8個位元組64個位元位 范圍:2^64-1 = 18446744073709551615 printf("%d\n", int(sizeof(float))); //4個位元組32個位元位 范圍:2^32-1 = 4294967295 printf("%d\n", int(sizeof(double))); //8個位元組64個位元位 范圍:2^64-1 = 18446744073709551615 return 0; } ////(---------------------------------------------------------------) */ //int main() //{ // double b = 13.14; // printf("%lf\n", b); //%lf--列印雙精度浮點數資料 // return 0; //} //(-------------------------------------------------------------- - ) /* #include <stdio.h> int main() { float a = 18.0; printf("%f\n", a); //%f -- 列印浮點數資料 return 0; } (---------------------------------------------------------------) #include <stdio.h> int main() { long h = 1300; printf("%d\n", h); //%d--列印整型十進制資料 return 0; } (---------------------------------------------------------------) #include <stdio.h> int main() { char ch = 'A'; printf("%c\n",ch); //%c--列印字符格式的資料 return 0; } (---------------------------------------------------------------) #include <stdio.h> int main() { char age = 18; printf("%d\n", age); //%d--列印整型十進制資料 return 0; } (---------------------------------------------------------------) 包含一個叫stdio.h的檔案 std-標準 standard input output #include <stdio.h> int main() //主函式-程式的入口 main函式有且僅有一個 { 這里完成任務 再螢屏上輸出hello world 函式-print function - printf - 列印函式 庫函式-C語言本身提供給我們使用的函式 別人的東西-打招呼 #include printf("hello 陌辰\n"); return 0; } (---------------------------------------------------------------) int 是整形的意思 main前面的int表示main函式呼叫回傳一個整數值 int main() { 這里完成任務 再螢屏上輸出hello world return 0;//回傳 } */

本文來自博客園,作者:{it陌辰},轉載請注明原文鏈接:{https://www.cnblogs.com/djhyyds/p/16783265.html}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/515057.html
標籤:其他
上一篇:Chrome 解析度測驗
下一篇:Python第六章實驗報告
