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