C Programming and Computer Geeks: online c training

Search MY Blog

Showing posts with label online c training. Show all posts
Showing posts with label online c training. Show all posts

Thursday 5 December 2013

C Header Files and its supported functionalities


<stdio.h>: input /output functional operations in program.

<conio.h>: to clear screen and pause information function.

<ctype.h>: functions for testing characters.

<string.h>: functions for manipulating string.

<math.h>: mathematical  functionalities.

<stdlib.h>: utility function for number, conversion and storage allocation.

<assert.h>: functions that can be used to add diagnostics to a program.

<stdarg.h>: functions that can be used to step through a list of function arguments.

<setjmp.h>: functions that can be used to avoid the normal call and return sequence.

<signal.h>: functions for handling exceptional condition that may arise in a program.

<time.h>: functions for manipulating date and time.

<limits.h>: constant definitions for the size of C data types.

<float.h>: definitions relating to floating-point arithmetic.


Click here for more C Tutorials and Concepts.

 

Sunday 1 December 2013

Understanding Pointers in C/C++

When we declare a variable in C/C++ etc.. like int x or int y , it tells the compiler to reserve the space of two bytes(Size depends on OS Platforms/Compilers ) in the memory to store the integer type value and identify the storage location in the memory by 'x' or 'y' etc.
So every variable has three properties 1. Identifier (Name like x or y) 2. Value(x=10 or y=15 etc.) 3. Its address (hexadecimal) in the Temporary Memory i.e. RAM. Since compiler makes our job simpler by giving an opportunity to know only the variable’s name and its value then in normal situation we have no need to worry about the location or address of the variable. But in advanced programming and certain types of problems we have to handle and use the address of variables. So the concept of Pointers solves this problem. 
We can say Pointer Definition as "Pointers are those variables which holds the address of another variable”. In C/C++ we can see the “Address” or “Memory Location Number” of any variable by using "&" i.e. if we declare a variable 'x' eg: int x; we can see its address by printf statement as follows printf("\n %d", &x);
Now to handle the address of variables we have the facility to declare the Pointer variable like this int *p; this statement tells the compilers to reserve the space in memory to store the address of integer type variable. To assign the address of any integer type variable to 'p' we have to write the statement like p = &x; 

Example Program:

Understanding Pointers in C
Pointers in C



void main()
{
 int x = 34; //variable declaration and definition.
 int *p; //pointer declaration.

 /* p is a pointer which points to a integer variable or ‘p’   is  a pointer which holds the address of an integer variable..  */
 p = &x; //Assigning the address of variable x to pointer ‘p’.
 printf("Address of variable x is : %x",p);//prints the  address  of variable x. here %x displays Address in Hexa  decimal format.
}

Clickhere for more C Tutorials and Concepts.



Friday 29 November 2013

Faq On Array Addition and subtraction



what could be the output of the following program.

int main()
{
char *p = a;
printf("%s", p + p[5] - p[13]);
getch();
return 0;
}

Ans: It will display the below output
.neentech.blogspot.com

Array addition and subtraction

Explanation:  From the Statement p + p[5] – p[13], p points to address of array a . And p[5] contains/holds character ‘e’ and p[13] holds character ‘b’. So the final statement will be p + ’e’ – ‘b’ ==> p + 101 – 98 (here 'e' equals to decimal 101 & 'b' equals to Decimal 98) ==> p+3 ==> will give the address location of a[3]. So it will start printing the string from a[3].

Click here for more C Faq

Search This Blog