i can't understand the output that give by my code which use with pointers. can anyone help me with this
here is my code,
#include <stdio.h>
void main(){
struct stype {
int x;
char *p;
};
struct stype s[ ] = {
{ 1 , "Colombo" },
{ 2 , "Gampaha" },
{ 3 , "Kalutara" },
{ 4 , "Matara" },
{ 5 , "Galle" },
};
struct stype *t;
t = s;
t++;
printf( "%d\n" , t->x );
printf( "%c\n", *( ++t->p ) );
printf( "%s\n" , t->p );
printf( "%d\n" , ( ++t )->x );
printf( "%s\n", ++t->p );
printf( "%s\n" , ++t->p );
printf( "%c\n" , *( ++t->p ) + 5 );
}
Here is the output i get
2
a
ampaha
3
alutara
lutara
z
void main()is an invalid program startup. See: C11 Standard §5.1.2.2.1 Program startup p1 (draft n1570). See also: See What should main() return in C and C++?void main()as a signature.