Software languages

What are C Tokens?

C programs contains many elements which are identified by the compiler as Tokens. Tokens can be categorized as 1. Keywords2. Variables3. Constants 4. Special characters 5. Operators C Token example program: int main() { int x, y, sum; x = 5, y = 10; sum = x + y; Printf (“Sum = %d \n”, sum); […]

What do you mean by header file in C language?

header file contains the library functions along with the necessary definitions and declarations. C programming language have a directive, often called include (as well as copy and import), that causes the contents of a second file to be inserted into the original file. For example #include causes the contents of a file stdio.h to be […]

What is a global variable?

variables that are known throughout the program and may be used by any piece of code is called a global variable. Also, they will hold their value throughout the program’s execution. Global variables can be created by declaring them outside of any function. Global variables are helpful when many functions in the program use the […]

What is a local variable?

Variables that are declared inside a function are called local variables. Local variables can be used only by statements that are inside the block in which the variables are declared. In other words, local variables are not known outside their own code block. A block of code begins with an opening curly brace and terminates […]

what is Void Pointer?

Void pointer or generic pointer is a special type of pointer that can be pointed at objects of any data type. A void pointer is declared like a normal pointer, using the void keyword as the pointer’s type. Pointers defined using specific data type cannot hold the address of the some other type of variable […]

What is dangling pointer?

Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type. In many applications memory is allocated for holding data objects. After using these objects, tha aplication will de-allocate this memory so that the memory can be re-used. In some cases the alications may […]

How to convert List – Long to long or vise versa?

There is no automatic conversion from array of primitive type to array of their boxed reference types or vise versa. You have to iterate for each data. Converting List<Long> to long[] 1 2 3 4 5 6 7 List input = getSomeLongs(); // Assume some values long[] output = new long[input.size()]; int index = 0; […]

How to use Enum in C?

In C and C++, enum types can be used to set up collections of named integer constants. Consider a set of all days. #define Sunday 0 #define Monday 1 #define Tuesday 2 #define Wednesday 3 #define Thursday 4 #define Friday 5 #define Saturday 6 The above lines can be replaced by: 1 enum AllDays{Sunday, Monday, […]

How to use bool in c?

There is no bool data type in C. In C99 standerd version, the boolean variable has been added as _Bool. Additionally, a new header stdbool.h has been added for compatibility reasons. This header allows programmers to use boolean types in the same way, as in C++ language. To use bool in C, we can use […]