Directory
Technology
Blog Details for "C CPP Blogging"
C CPP BloggingC CPP BloggingThis site features c,cpp programming, embbed systems programming for professionals and students Articles
Safe String Copy(strcpy) and Concatenate(strcat) Operations
2007-12-04 17:27:00 I’d covered bad standard APIs in my previous article, here I’ve attempted to overcome those defects in standard APIs, please check these fucntions.. I’ll post more functions later.. Strcpy: 1)copy src to string dst of size size 2)At most size-1 characters will be copied 3)Returns strlen(src); if retval >= size, truncation occurred 4)Always NUL terminates (unless size is 0) size_t safe_strcpy(char ... More About: Copy , String , Safe , Tring , Tena
i64toa - Converts a 64 bit integer to string
2007-12-04 16:35:00 Here is the program for converting a 64bit integer to string/char */ascii.. Please let me know any issues, suggestions.. //Converts a 64bit integer to a string bool i64toa( int64 value, char * buf, int maxLen) { int lsbByte = 0; char tempchr[10]; char tmpchar; int count = 0; int bufLen = 0; bool ... More About: String , Tring , Vert
Clipping and Clamping with out ?if condition?
2007-06-14 17:19:00 Given an example, if the signed integer number is more than 255 then set the number to 255(clipping). On the other hand, if the signed integer is less than 0, then set the number to 0(clamping). This is implemented in C using ‘if condition’, which looks like the below code int ClipNClamp(int val) { if(val < 0) ... More About: Condition , Lamp , Ping , Condi , Lippi
Clipping and Clamping with out ?if condition?
2007-06-14 17:19:00 Given an example, if the signed integer number is more than 255 then set the number to 255(clipping). On the other hand, if the signed integer is less than 0, then set the number to 0(clamping). This is implemented in C using ‘if condition’, which looks like the below code int ClipNClam p(int val) { if(val < 0) ... More About: Condition
Constant and Volatile
2007-05-28 19:41:00 Any type can be qualified by the type qualifiers const or volatile.In simple declarations, the type qualifier is simply another keyword in the type name, along with the basic type and the storage class. Syntax for the const and volatile keywords int * volatile x; /* x is a volatile pointer to an ... More About: Expressions , Types
Constant and Volatile
2007-05-28 19:41:00 Any type can be qualified by the type qualifiers const or volatile.In simple declarations, the type qualifier is simply another keyword in the type name, along with the basic type and the storage class. Syntax for the const and volatile keywords /*Syntax 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: #b1b100;}.ch_code_container .kw2 ... More About: Const , Cons
L-Value and R-Value Expressions
2007-05-28 07:42:00 Expressions that refer to memory locations are called “l-value” expressions. An l-value represents a storage region’s “locator” value, or a “left” value, implying that it can appear on the left of the equal sign (=). L-values are often identifiers. Expressions referring to modifiable locations are called “modifiable l-values.” A modifiable l-value cannot have an array type, ... More About: Expressions , Sion , Xpress , Value , Express
L-Value and R-Value Expressions
2007-05-28 07:42:00 Expressions that refer to memory locations are called “l-value” expressions. An l-value represents a storage region’s “locator” value, or a “left” value, implying that it can appear on the left of the equal sign (=). L-values are often identifiers. Expressions referring to modifiable locations are called “modifiable l-values.” A modifiable l-value cannot have an array type, ... More About: Expressions , Types
What is a reentrant function?
2007-05-22 15:55:00 A reentrant function is one that can be used by more than one task concurrently without fear of data corruption.Whereas, a non-reentrant function is one that cannot be shared by more than one task unless mutual exclusion to the function is ensured either by using a semaphore or by disabling interrupts during critical sections of ... More About: Function , Tran
What is a reentrant function?
2007-05-22 15:55:00 A reentrant function is one that can be used by more than one task concurrently without fear of data corruption.Whereas, a non-reentrant function is one that cannot be shared by more than one task unless mutual exclusion to the function is ensured either by using a semaphore or by disabling interrupts during critical sections of ... More About: Function , Tran
Circular Linked Lists
2007-05-17 14:24:00 Please visit my earlier post linked lists for basics of linked lists. Visit this post for circular double linked lists What is circular linked list? Circular Linked lists are chain of records/nodes, one record/node points to the next, and last node/record pointing to the first node instead of pointing to a sentinel. Record/node holds the data. Why circular ... More About: Lists
Circular Linked Lists
2007-05-17 14:24:00 Please visit my earlier post linked lists for basics of linked lists. Visit this post for circular double linked lists What is circular linked list? Circular Linked lists are chain of records/nodes, one record/node points to the next, and last node/record pointing to the first node instead of pointing to a sentinel. Record/node holds the data. Why circular ... More About: Lists
C++ Reference Card
2007-05-09 08:01:00 Download [C++ Refer ence Card ] reference cards More About: Ferenc
Printing linked List in Reverse without Reversing The List Actually
2007-05-06 11:18:00 Printing a linked list in reverse order without actually reversing the linked list can be done by a recursive routine or using a stack. Lets us see a recursive routine first… In recursive routine go to the end then print the nodes, i.e. recursive call comes before printing the node… Here is the function… /*Syntax Highlighter*/.ch_code_container {font-family: ... More About: List , Verse , Inti , Printing , Reversi
Josephus Problem in C
2007-05-06 10:13:00 Q:Jose phus Flavius was a famous Jewish historian of the first century at the time of the Second Temple destruction. During the Jewish-Roman war he got trapped in a cave with a group of 40 soldiers surrounded by romans. The legend has it that preferring suicide to capture, the Jews decided to form a circle and, ... More About: Problem
Sorting a Linked List with QuickSort - Simple Algorithm
2007-05-01 16:12:00 Quicksort is the fastest known sorting algorithm in practice. Its average running time is O(nlogn). It is based on devide and conquer idea: partition into two lists and put them back together again. It does more work on the divide side, less on the combine side. The basic algorithm is 1)pick any element (called as Pivot) in list 2)Partition ... More About: List , Simple , Sorting , Sort
Sorting a Linked List with Selection Sort
2007-04-29 15:56:00 The basic idea of selection sorting algorithm is 1)find minimum element in the list 2)swap it with the beginning element 3)repeat the above steps after moving pointer to next element Here is the graphical representation of operation of this algorithm… Before we go to linked list sorting understand how do we sort for an array… Here is the C code for ... More About: List , Sorting , Sort , Select , Sele
Detecting a loop in single linked list
2007-04-22 15:37:00 Please refer this post for linked list basics and all other operations on linked lists. Loop s in linked list can be detected by inserting dummy nodes after every node, so if we find dummy node after a node already, that says that list has a loop. The diagram below explains this. This method takes O(n) time ... More About: List , Single
Sorting A Linked List with Bubble Sort
2007-04-11 18:31:00 The basic idea of this sorting algorithm is to compare two neighboring objects, and to swap them if they are in the wrong order. here is an example, which shows sorted list in several passes.. 5 10 20 13 7 17 5 10 13 7 17 205 10 7 13 17 205 7 10 13 ... More About: With , Link , List , Sorting , Sort
C++ Tutorial Part 2 - Advanced
2007-04-03 15:14:00 C++ Tutorial Part II - Advanced Silan Liu download this tutorial as 1. VPTR AND VTABLE 1.1 A Class and its Objects in the Memory 1.2 Linking of a Method Call 1.3 Memory Footprint of a Non-polymorphic ... More About: Tori , Rial , Vance
C++ Tutorial Part 2 - Advanced
2007-04-03 15:14:00 C++ Tutorial Part II - Advanced Silan Liu download this tutorial as 1. VPTR AND VTABLE 1.1 A Class and its Objects in the Memory 1.2 Linking of a Method Call 1.3 Memory Footprint of a Non-polymorphic ... More About: Tori , Rial , Vance
C++ Tutorial Part I - Basic
2007-04-02 15:04:00 C++ Tutorial Part I - Basic Silan Liu download PDF 1. C++ Basics 1.1 Advantage of Structured Programming 1.2 Interpreter and Compiler Program 1.3 Escape Sequence 1.4 Namespace 1.5 Advantages of ... More About: Tori , Rial
Reversing a double linked list
2007-03-30 14:13:00 refer double linked list post for information about double linked list. Here in this post we will be discussing about reversing a double linked list. Here is the pictorial representation of our algo… in our routine we will swap our next, prev pointers of nodes to reverse the double linked list… this routine capable of reversing ... More About: Double , Link , List , Sing , Ever
Detecting broken links in double linked list
2007-03-30 12:42:00 Here is a routine which does find out broken links in double linked list, wondering what is a broken link… here is the code snippet for detecting broken links in double linked list… for complete operations (all operations) on double linked list, visit earlier post /* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */.ch_code_container {font-family: monospace;white-space: nowrap;height:100%;}.ch_code_container .imp ... More About: Double , Links , Link , List , Broken
Stream buffering
2007-03-30 12:29:00 The following program doesn’t "seem" to print "hello-out". What is the reason behind it? #include <stdio.h> #include <unistd.h> int main() { while(1) { fprintf(stdout,"hello-out"); fprintf(stderr,"hello-err"); sleep(1); } ... More About: Ring , Stream , Buff , Buffer , Erin
Reversing a single linked list using stack
2007-03-30 12:10:00 Here is the routine for reversing single linked list using a stack, for reversing linked list using pointers, see the earlier post. For reversing linked list recursively visit this post. This routine takes a single linked list as argument and reverse it and returns back the head node to the reversed list. /* GeSHi (c) Nigel ... More About: Link , List , Sing , Ever , Single
Reversing single linked list recursively
2007-03-30 12:00:00 Here is the routine for reversing single linked list recursively, for reversing iteratively see the earlier post . For reversing circular single linked list visit this post. This routine takes a single linked list as argument and reverse it and returns back the head node to the reversed list. /* GeSHi (c) Nigel McNie 2004 ... More About: Link , List , Sing , Ever , Single
inline bool isprime()
2007-03-29 16:21:00 This is one of the more simple snippets I could actually write, and one of the best memorized pieces of code that I can actually write as the starting post of this blog. For interested bloggers who would want to be able to post their snippets here, contact me (Dean Michael Berris) through email (see ... More About: Line , Prime , Rime , Prim
C++ and Java Context Switch
2007-03-28 11:12:00 The past couple of days, I had been working on a project which requires me to write Java code. OK, I know, this is a C++ blog — this is my blog after all — but there’s something I’ve picked up a couple of days that I would like to share. I found a few important ... More About: Switch , Text , Context , Witch
Unsigned long long (uint64) to string (ulltostr)
More articles from this author:2007-03-22 06:19:00 Here is the code snippet which does conversion from unsigned long long (uint64) to string/ascii/char *. it takes input as unsigned long long (uint64), converts it to string, it takes care of the base also. example usage of function ulltostr is: ulltostr(1023234343453553, ptr, 10); here is the code snippet…. /* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */.ch_code_container {font-family: monospace;white-space: ... More About: Signed , Ring , Sign , Long , String 1, 2, 3 |



