What is a global variable?

Tuesday, February 14th, 2012  »  Posted By  »  Total 0 Comment

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?

Tuesday, February 14th, 2012  »  Posted By  »  Total 0 Comment

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 the use of sizeof() operator in C?

Tuesday, February 7th, 2012  »  Posted By  »  Total 0 Comment

The sizeof operator returns the size in bytes of its operand. Operand may be a variable or data type.

what is Void Pointer?

Thursday, January 19th, 2012  »  Posted By  »  Total 7 Comments

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?

Tuesday, January 17th, 2012  »  Posted By  »  Total 0 Comment

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 to long[] or vise versa?

Thursday, January 12th, 2012  »  Posted By  »  Total 1 Comment

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<Long> input = getSomeLongs(); // Assume some values long[] output = new long[input.size()]; int index = 0; […]

How to use Enum in C?

Monday, January 2nd, 2012  »  Posted By  »  Total 0 Comment

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?

Monday, January 2nd, 2012  »  Posted By  »  Total 1 Comment

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 […]

What is the differnce between Structure and Union?

Thursday, September 1st, 2011  »  Posted By  »  Total 0 Comment

The difference between structure and union is, 1. The amount of memory required to store a structure variable is the sum of the size of all the members. On the other hand, in case of unions, the amount of memory required is always equal to that required by its largest member. 2. In case of […]

How to resize image using php?

Thursday, September 1st, 2011  »  Posted By  »  Total 1 Comment

Here is a simple script to resize the given image. This requires PHP5, GD library. First download the file and include to your code. Usage example: 1 2 3 4 5 6 7 8 9 10 11 12 <?php // *** Include the class include("resize-class.php");   // *** 1) Initialise / load image $resizeObj = […]

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup