This document provides guidance on C programming conventions including:
1. Naming conventions such as using descriptive names for variables and functions with mixed case letters and avoiding special characters.
2. Program structure conventions such as writing comments at the beginning of files to describe purpose and last update, using indentation consistently, and writing functions and blocks on separate lines.
3. Project organization conventions such as creating header files for shared declarations, using include files to share common macros and types across files, and organizing source files into a consistent folder structure.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
59 views
C Programming Help
This document provides guidance on C programming conventions including:
1. Naming conventions such as using descriptive names for variables and functions with mixed case letters and avoiding special characters.
2. Program structure conventions such as writing comments at the beginning of files to describe purpose and last update, using indentation consistently, and writing functions and blocks on separate lines.
3. Project organization conventions such as creating header files for shared declarations, using include files to share common macros and types across files, and organizing source files into a consistent folder structure.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
MOT SO HONG OAN LAP TRNH C
. MOT SO NGYKN TAC TRNH BAY CHONG TRNH NGON
1. Cuch dut ten hum, ben, keu du leu, hung KhI fon ham, fon bIon Ia su kof hop cua nhIou fu fh cac fu duoc vIof IIon nhau |khong non dung dau gach duoI _ do phan cach), k fu dau cua moI fu vIof hoa, cac k fu con IaI cua moI fu vIof fhuong. V du : LoadData, FindShortestWay, NumLines, GraphData, Ton bIon : fhuong baf dau bang mof danh fu. Tuy nhIon do fhuan fIon cho vIoc fhoo doI chuong frnh, nguoI fa fhuong fhom fruoc fon bIon mof so k fu vIof fhuong do chI kIou du IIou cua bIon do. Cac k fu fhuong duoc dung frong quI uoc nay fhuong Ia : sz : kIou chuoI c : kIou k fu f : kIou so fhuc n : kIou so nguyon p, lp : kIou con fro l : kIou so Iong V du : char *szFileName; // szFileName Ia bIon kIou chuoI LPEVENT lpEvent; // lpEvent Ia bIon kIou con fro Ton ham : fhuong baf dau bang mof dong fu. Thu fu cac fham so frong ham duoc quI uoc fhoo fhu fu : cac du IIou fra vo, cac du IIou vao, V du : void CopyArray(int *Dest, int *Src, int NumElement); int LoadData(char *szFName); Ton hang, kIou du IIou fhuong duoc vIof bang chu In hoa. V du : #define MAX 10 #define TIMEDELAY 50 typedef struct { int Left, Top; int Right, Bottom; }RECT; 2. Cuch trInh buy au moI chuong frnh hay fap fIn dou co mof so dong mo fa. Cac fhong fIn fhuong do cap frong phan nay fhuong Ia : fon fap fIn, fom faf muc dch cua chuong frnh, moI fruong Iam vIoc, frnh bIon djch, fac gIa, ngay cap nhaf cuoI cung, V du : /***************************************************************************************************** * File Name : GRAPH.CPP Graph Function : Load data, display, * * Compiler : BC++3.1. * * Written by : Le Dinh Duy Info Dept, HCMUNS. * * Last Update : 03/12/1998 * *****************************************************************************************************/ MoI cau Ionh vIof fron mof dong. Cac cau Ionh cung cap vIof fron cung mof cof, cac cau Ionh co cap nho hon vIof fhuf vao frong, cach Ionh cap fron bang mof khoang Tab |fhuong daf Tab Size=4) V du : void Demo(void) { int x, y; printf(Input x, y : ); scanf(%d%d, &x, &y); if(x!=y) printf(Input error); else printf(Input valid); } . HONG OAN LAP TRNH PROJKCT 1. Mot so thuo tuc : Tao mof projocf : chon monu Project/Open Project. Tap fIn projocf fhuong co phan mo rong Ia .PRJ. HIon cua so projocf : chon monu Window/Project. Thom/ bo mof fap fIn vao/ra projocf : mo cua so projocf, dung phm Ins do fhom, phm Del do bo. ong mof projocf : chon monu Project/Close Project. 2. Mot so nguyen tuc kh ket no du leu trong Project. Cac fap fIn .H fhuong dung do khaI bao cac bIon du IIou va ham dung chung |export data). Cac fho hIon cu fho cua cac bIon va ham nay duoc caI daf frong fap fIn .CPP fuong ung. o franh khaI bao frung Iap khI kof noI cac fap fIn vao frong projocf, baf dau va kof fhuc fap fIn .H fhuong fhom mof so dong : #ifndef _ _ <Ten tap tin> _ H _ _ // V du #ifndef __GLOBAL_H__ #define _ _ <Ten tap tin> _ H _ _ // Cac khai bao ghi o day #endif // Ket thuc tap tin Cac kIou du IIou, hang, macro dung chung khaI bao frong cac fap fIn .H do khI dung fh include vao. Cac fhanh phan dung chung |bIon, ham) khaI bao frong fap fIn .H baf dau bang fu khoa extern, fho hIon cua chung chI khaI bao mof Ian duy nhaf frong fap fIn .CPP fuong ung. Tap fIn projocf fhuong chua cac fap fIn caI daf .CPP, fhu vIon doI fuong .OBJ, Cac fap fIn frong cung mof projocf fhuong duoc fo chuc frong cung mof fhu muc do fIon cho vIoc Iuu fru, kof noI.