C 程式語言的侷限性
問題
與其他程式語言相比,C 程式語言有哪些侷限性?
解決方案
與面向物件程式語言相比,C 語言沒有或者禁止了繼承、多型、封裝和資料抽象等概念。
C 程式語言不會檢測每一行程式碼的錯誤,它會在整個程式碼完成後檢查錯誤。
它沒有名稱空間屬性。
C 程式設計的資料抽象能力不夠,即沒有很大的資料處理能力。
C 語言不允許使用者藉助異常處理功能檢測錯誤。
C 語言不支援建構函式和解構函式的概念。
它不支援完全解決實際問題。
與其他程式語言相比,它的安全性較低。
基本結構
\“C\”程式的一般結構如下 −
/* documentation section */
preprocessor directives
global declaration
main ( ){
local declaration
executable statements
}
return type function name (argument list){
local declaration
executable statements
}示例
/* Author : Tutorialspoint
Aim : Program for finding circumference of circle*/
#include<stdio.h>
#include<conio.h>
#define PI 3.1415
main ( ){
float c, r;
clrscr ( );
printf ("enter radius of circle");
scanf ("%f", &r);
c = 2 * PI * r;
printf ("Circumference = %f", c);
getch ( );
}輸出
Enter radius of circle r=4 Circumference of circle c=25.132000
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP