Tag: Source Code

Ternary Operator with examples in C

In C Programming, ternary operator allows executing different code depending on the value of a condition. The returned value is the result of the expression when the code is executed. The main advantage of using ternary operator is to reduce the number of lines of code and improve the performance of application. In C, the real utility of ternary operator is that it is an expression instead of a statement i.e. you can have it on the right-hand side (RHS) of a statement. So you can write certain code statements more concisely.

Read More

Ternary Operator with examples in C++

In C++, ternary operator allows executing different code depending on the value of a condition, and the result of the expression is the result of the executed code. The ternary operator uses 3 operands. It evaluates a condition and after that chooses one of its two branches to execute, depending upon the result of condition. The symbol for ternary operator is “? :”. The syntax for the ternary operator is: ? : ;

Read More

C Implementation of Base64 Encoding and Decoding

Base64 encoding and decoding schemes are commonly used to encode binary data. Normally this is required when textual data needs to be transferred over the network or similar media and make sure that data is transferred without any modification. Base64 is commonly used in a number of applications, including email via MIME, and storing complex data in XML. This is a very simple implementation of base64 encoding and decoding in C programming language. There are number of C libraries available for encoding and decoding as well i.e. libb64, OpenSSL Base64, Apple’s Implementations, arduino-base64 etc.

Read More

Porter’s Algorithm in C

Originally written in 1979 at Computer Laboratory, Cambridge (England), it was reprinted in 1997 in the book “Readings in Information Retrieval”. Initially it was written in BCPL language. Here is the list of implementations in other programming languages including C, Java and Pearl implementations done by author himself.

Read More
Mothers Day Gift Ideas