Friday, August 17, 2012

Pointer In C (In Depth) (Final) Part 4

Generic Pointer in C Programming

Generic pointer:
void pointer in c is known as generic pointer. Literal meaning of generic pointer is a pointer which can point type of data.

Example:

void *ptr;

Here ptr is generic pointer.

Thursday, August 16, 2012

Pointer in C (In Depth) Part 3


Pointer to function in c programming

What will be output if you will execute following code?
int * function();
void main(){
auto int *x;
int *(*ptr)();
ptr=&function;
x=(*ptr)();
printf("%d",*x);
}
int *function(){
static int a=10;
return &a;
}
Output: 10
Explanation: Here function is function whose parameter is void data type and return type is pointer to int data type.
x=(*ptr)()
=> x=(*&functyion)() //ptr=&function
=> x=function() //From rule *&p=p
=> x=&a
So, *x = *&a = a =10


Pointer in C (In Depth) Part 2


Arithmetic Operation with Pointer in C Programming


Rule 1:

Address + Number= Address
Address - Number= Address
Address++ = Address
Address-- = Address
++Address = Address
--Address = Address

Monday, August 13, 2012

Pointer In C (In Depth) Part 1



POINTER

Pointer is a variable just like other variables of c but only difference is unlike the other variable it stores the memory address of any other variables of c. This variable may be type of int, char, array, structure, function or any other pointers. 

For examples:

(1) Pointer p which is storing memory address of a int type variable:
int i=50;
int *p=&i;

(2) Pointer p which is storing memory address of an array:

int arr[20];
int (*p)[20]=&arr;


Thursday, August 9, 2012

String In JAVA

Strings

Definition:

Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects.

The Java platform provides the String class to create and manipulate strings.


Creating Strings

The most direct way to create a string is to write:


String greeting = "Hello world!";


Garbage Collector in Java


The Garbage Collector in JAVA

Some object-oriented languages require that you keep track of all the objects you create and that you explicitly destroy them when they are no longer needed. Managing memory explicitly is tedious and error-prone. The Java platform allows you to create as many objects as you want (limited, of course, by what your system can handle), and you don't have to worry about destroying them. The Java runtime environment deletes objects when it determines that they are no longer being used. This process is called garbage collection.
 

Wednesday, August 8, 2012

Data Structures Interview Questions and Answers


Data Structures Interview Questions and Answers

Q 1. What is data structure?

Ans.  A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data.

Q 2. List out the areas in which data structures are applied extensively?
Compiler Design, Operating System, Database Management System, Statistical analysis package, Numerical Analysis, Graphics, Artificial Intelligence, Simulation