/*WAP to Using pointer to access array elements */
#include<stdio.h> #include<conio.h> main( ) { char name[ ] = "Goldfish" ; char *ptr ; ptr = name ; /* store base address of string */ while ( *ptr != `\0' ) { printf ( "%c", *ptr ) ; ptr++ ; } }
there is some good c ,java, sql and vb6 programs,Windows tricks, sms shorthand etc
#include<stdio.h> #include<conio.h> main( ) { char name[ ] = "Goldfish" ; char *ptr ; ptr = name ; /* store base address of string */ while ( *ptr != `\0' ) { printf ( "%c", *ptr ) ; ptr++ ; } }
#include<stdio.h> #include<conio.h> main( ) { char name[ ] = "Klinsman" ; int i = 0 ; while ( name[i] != `\0' ) { printf ( "%c", name[i] ) ; i++ ; } }
#include<stdio.h> #include<conio.h> main( ) { char name[ ] = "Goldfish" ; int i = 0 ; while ( i <= 9 ) { printf ( "%c", name[i] ) ; i++ ; } }
#include<stdio.h> #include<conio.h> main( ) { int s[5][2] = { { 1234, 56 }, { 1212, 33 }, { 1434, 80 }, { 1312, 78 } } ; int ( *p )[2] ; int i, j, *pint ; for ( i = 0 ; i <= 3 ; i++ ) { p = &s[i] ; pint = p ; printf ( "\n" ) ; for ( j = 0 ; j <= 1 ; j++ ) printf ( "%d ", *( pint + j ) ) ; } }
#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 %d ", num[i], *( num + i ) ) ; printf ( "%d %d", *( i + num ), i[num] ) ; } }