Write a function code for stack peep operation

void peep(){
	 int pos;
	 printf("Enter position:");
	 scanf("%d",&pos);
	 if(top-pos+1 < 0){
	     printf("invalid Position");
	 }
	 else{
	     printf("%d\t",stack[top-pos+1]);
	 }
}