DirectoryTechnologyBlog Details for "C CPP Blogging"

C CPP Blogging

C CPP Blogging
This site features c,cpp programming, embbed systems programming for professionals and students
Articles: 1, 2, 3

Articles

ANSI C Vs K&R C
2007-03-15 09:52:00
There are three important differences between ANSI C and K&R C: The first feature is the prototype - writing the parameter types as a part of the function declaration.  Prototypes make it easy for a compiler to check function use with definition.  Second feature is the addition of new keywords - enum for enumerated types const volatile signed void And the ‘entry’ ...
A tip for writing conditional statements
2007-03-15 09:46:00
Did you know that the following if statement is semantically right, but could logically be wrong?     if ( i = 2 )    {       0; /* do something */    }    Tip: The compiler may only produce a waring: "Possibly incorrect assignment", but we may ignore it.  To avoid such a mistake, just reverse the two identifiers.     if ( ...
More About: Writing , Men , State , Condition , Stat
A note on using Unions
2007-03-15 09:34:00
Consider the following program -     #include <stdio.h>     int    main ( void )    {       0; union {       0;  int     _i;      &# 160;  float   _f;      &# 160; }_u = { 10 };         ; printf ( "%f ", u.f );       60; return 0;    } Keep the following points on how a union object is represented in the memory: The size of an union object is equal to size ...
More About: Union , Note , Unions , Sing
Reversing a circular single linked list using pointers
2007-03-10 12:20:00
Reversing a single linked list is explained in this post this post deals with reversing circular single linked list, which is not much different from what we did there except the last reversed node points the head node, then we change the head node to point to reversed linked list…. here is the routine which reverses circular ...
More About: Inter , Link , List , Sing , Ever
Circular Doubly Linked List With Out Using Special Head or Tail Node
2007-03-01 07:28:01
Circular double linked list can be traversed clockwise or anticlockwise. In this list all nodes are linked as shown in the below figure. The only difference between double linked list and circular double linked list is last node points to first node in the list, first node points to last node instead of pointing to NULLs.   ...
More About: With , Link , List , Special , Sing
Composition Over Inheritance
2007-02-27 13:25:05
Several Patterns books will always say that composition is preferred over inheritance, because it makes your code more reusable, and more flexible. Let’s see a usual example of this in C++, using pointers or references: /* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */.ch_code_container {font-family: monospace;white-space: nowrap;height:100%;}.ch_code_container .imp {font-weight: bold; color: red;}.ch_code_container .kw1 {color: #0000ff;}.ch_code_container .kw2 ...
More About: Comp , Composition , Over , Inheritance , Posi
A Simple Timer?
2007-02-27 01:24:10
I got inspired by an officemate’s suggestion (thanks sir Chie) to make a tool which allowed you to invoke a command and have it timed to the second. This is because we needed a tool which would run a script in a predetermined number of seconds, and cron was too clumsy to use. So with ...
More About: Time , Simp , Simple , Timer
Can we use printf() in an ISR?
2007-02-22 01:20:03
No we cannot use printf() in ISR because ISRs’ are a part of kernel and kernel is not linked with libaray provided by C,so when we use printf() in ISR it should generate a linkage error. Miscellaneous, Question PatternsBookmark this post:
More About: Print
Palindrome Checker
2007-02-21 01:20:02
Palindrome checker takes input from a file or keyboard, and lists out all palindrome words. This checker identifies even multiple words which are palindrome. This is a console based program, without arguments to the program, will act as a console shell, which takes input from keyboard and processes the words. Recursive string reversal function is used ...
More About: Rome , Check , Hecker , Pali , Checker
Printing array spirally - c program
2007-02-17 13:17:01
Printing array in spiral order is not that tough as we think, if we properly maintain directions and positions of indexeswe are done, here is such simple program… /*Printing array spirally for ex. 1    2    3    4 5    6    7    8 9    10   11  12 13   14   15   16 need to print the above matrix in 1, 2, ...
More About: Rally , Print , Prog , Program , Inti
IEEE 754 Binary Floating Point Representation
2007-02-17 13:17:01
How the floating point values are stored? Note: Please note that this discussion is not related to the C Language. To be able to represent floating point numbers in the bit pattern, one needs to know about IEEE 754, the floating point specification. So, read patiently. IEEE Floating Point Format: --------------------------- 3 3 ...
More About: Present , Presentation , Resent
ASCII Case Conversion
2007-02-17 13:17:01
/* * case_conv.c - Program to change case without using arithmetic * operators or library functions. This program * ...
More About: Case , Sion , Conversion , Version , Ascii
Bus Error
2007-02-17 13:17:01
Bus error occurs when hardware tells the OS about a problematic memory reference.  In practice, a bus error is almost always caused by a misaligned read or write.  It’s called a bus error, because the address bus is the component that chokes if a misaligned load or store is requested. union {    char a[10];    int i;}u; A ...
More About: Error
How the keyboard works?
2007-02-17 13:17:01
Keyboard input follows an event path beginning with the keyboard controller chip and ending with characters being placed in a 30-byte array called the keyboard typeahead buffer(predefined system data i.e. 0×001E to 0×003D in BIOS Data Area). Up to 15 keystrokes can be held there at any given moment, because each keystroke generates 2 bytes ...
More About: Work , Board , Works , Keyboard
Data types in C
2007-02-17 13:17:01
The C programming language offers various data types to suit different purposes. They can be broadly categorized as follows: Integral types (char, short, int, long, long long, enum, _Bool) Real floating types (float, double, long double) Complex floating types (float _Complex, double _Complex, long double _Complex)  (New feature void is an empty set of values Derived types (struct type, union ...
More About: Data , Type , Types
Bit swapping - Style II
2007-02-17 13:17:01
This program shows a logic of swapping the most significant bit with the least significant bit, second most significant bit with the second least significant bit, and so on. /*! * swap-bits.c * Interchange bits of a byte in the following pattern: * bit7 <-> bit0 * bit6 <-> bit1 * bit5 <-> bit2 * bit4 ...
More About: Wap , Style , Swap , Ping
Bit swapping - Style I
2007-02-17 13:17:01
This program shows a logic of swapping the most significant bit with the least significant bit, second most significant bit with the second least significant bit, and so on. /* * swap_bits.c  -   Swap corresponding bits*/ /* *  This program swaps the corresponding bits of a character.  For example, *       0;   msb (bit 7) is exchanged with lsb ...
More About: Wap , Style , Ping
String Reversal
2007-02-17 13:17:01
/*! * string_reverse.c: Reverse a string Feb 17, 2006 */ #include <stdio.h> #include <string.h> void reverse_str(char *str, int start, int end) { char c = str[start]; str[start] = str[end]; str[end] = c; start++; end–; if (start ...
More About: Ring , Ever , String , Tring
How to distinguish parameter passing techniques?
2007-02-17 13:17:01
Before we see what the output of the program shown below is, let us learn how to distinguish two parameter passing techniques: pass by value and pass by address. Keep the following rule in mind:If the declaration of argument matches the declaration of the formal parameter, then the argument is passed by value. To be more ...
More About: How To , Tech , Technique , Para , Sing
More articles from this author:
1, 2, 3
111751 blogs in the directory.
Statistics resets every week.


Contact | About
© Blog Toplist 2012 - Supported by Web Catalog - SEO by FeWorks
eXTReMe Tracker