/*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 ) ; }
there is some good c ,java, sql and vb6 programs,Windows tricks, sms shorthand etc
#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 ) ; }
#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 ) ; }
#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) }
#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 ) ; }