Skip to content

saarques/Cprogramming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cprogramming

Contains C programs for daily practice.

Installing an editor

Installing Sublime Text in Ubuntu
Installing sublime with terminal

Prime Numbers

Prime Numbers Wiki
Prime number facts and tables

References

C programming.net
Tutorials Point
Learn C

Pattern Exercises

Pyramic Patterns
Star Patterns in C

Some Books

The C book
C text

Coding style

I. Variables - use lowercase and '_' to separe the words: int test_var;

II. Pointers - use '*' near pointer name: int *pointer name;

III. Structures and unions - naming same as for variables:

struct test_struct {
	int test;
	int *pointer;
};

IV. Typedefs: use '_t' postfix: typedef test_struct test_struct_t; ('_t' minds that it is a type)

V. Functions - C Standard Style:

size_t strlen(char *str)
{
	... FUNCTION BODY ...
}

VI. Code blocks - code block like for, while, do, if:

if (...) {
	...
} else if (...) {
	...
} else {
	...
}

do {
	...
} while (...);

for (...; ...; ...;) {
	...
}

switch (...) {
	case ...:
		...
		break;
	case ...:
		...
		break;
		
	....
	
	default:
		...
		break;
}

VII. Commenting - there are 3 situatuions:

a) on file start: You must write copyright and license and file description

/* ... name ...
 * 
 * Copyright (c) 2015 ...name... (...mail...).
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 * 
 * ... description ...
 */

b) in header files before function declaration

/*
 * ... description ...
 */
int test_func();

c) inside source file - use '//' comments

About

contains c programmes for daily practice.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages