Earn by twitter on twivert

Sign up for PayPal and start accepting credit card payments instantly.

Thursday, September 16, 2010

WAP to access array elements


/*WAP to access array elements */
#include<stdio.h>
#include<conio.h>
main( )
{
 int  num[ ] = { 24, 34, 12, 44, 56, 17 } ;
 int  i ;

 for ( i = 0 ; i <= 5 ; i++ )
 {
  printf ( "\naddress = %u ", &num[i] ) ;
  printf ( "element = %d", num[i] ) ;
 }
}

WAP to print out the memory locations


/*WAP to print out the memory locations*/
#include<stdio.h>
#include<conio.h>
main( )
{
 int  num[ ] = { 24, 34, 12, 44, 56, 17 } ;
 int  i ;

 for ( i = 0 ; i <= 5 ; i++ )
 {
  printf ( "\nelement no. %d ", i ) ;
  printf ( "address = %u", &num[i] ) ;
 }
}

WAP to Comparison of two pointer variables


/*WAP to Comparison of two pointer variables */
#include<stdio.h>
#include<conio.h>
main( )
{
 int  arr[ ] = { 10, 20, 36, 72, 45, 36 } ;
 int  *j, *k ;

 j = &arr [ 4 ] ;
 k = ( arr + 4 ) ;

 if ( j == k )
  printf ( "The two pointers point to the same location" ) ;
 else
  printf ( "The two pointers do not point to the same location" ) ;
}

WAP to Subtraction of one pointer from another


/*WAP to Subtraction of one pointer from another*/
#include<stdio.h>
#include<conio.h>
main( )
{
 int  arr[ ] = { 10, 20, 30, 45, 67, 56, 74 } ;
 int  *i, *j ;

 i = &arr[1] ;
 j = &arr[5] ;
 printf ( "%d %d", j - i, *j - *i ) ;
}

WAP to Introducing pointers


/*WAP to Introducing pointers */
#include<stdio.h>
#include<conio.h>
main( )
{
 int  i = 3, *x ;
 float  j = 1.5, *y ;
 char  k = 'c', *z ;

 printf ( "\nValue of i = %d", i ) ;
 printf ( "\nValue of j = %f", j ) ;
 printf ( "\nValue of k = %c", k ) ;
 x = &i ;
 y = &j ;
 z = &k ;
 printf ( "\nOriginal address in x = %u", x ) ;
 printf ( "\nOriginal address in y = %u", y ) ;
 printf ( "\nOriginal address in z = %u", z ) ;
 x++ ;
 y++ ;
 z++ ;
 printf ( "\nNew address in x = %u", x ) ;
 printf ( "\nNew address in y = %u", y ) ;
 printf ( "\nNew address in z = %u", z ) ;
}


WAP to pass an array to a function by address


/*WAP to pass an array to a function by address*/
#include<stdio.h>
#include<conio.h>
main( )
{
 int  i ;
 int  marks[ ] = { 55, 65, 75, 56, 78, 78, 90 } ;

 for ( i = 0 ; i <= 6 ; i++ )
  disp ( &marks[i] ) ;
}

disp ( int  *n )
{
 show ( &n ) ;
}

show ( int  *m )
{
 printf("%d  ",*m)
}

WAP to Demonstration of call by value


/*WAP to Demonstration of call by value*/
#include<stdio.h>
#include<conio.h>
main( )
{
 int  i ;
 int  marks[ ] = { 55, 65, 75, 56, 78, 78, 90 } ;

 for ( i = 0 ; i <= 6 ; i++ )
  display ( marks[i] ) ;
} 

display ( int  m )
{
 printf ( "%d ", m ) ;
}

ADS

How to earn online

How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786

AddMe

Bookmark and Share