Hi,

In the program run below i get the output as follows:

Enter the string
Hackers have put us on hit list

Hackers
have
put



I had a doubt regarding the output. The program has five scanf statements and i need to pass the string "Hackers have put us on hit list" when it prompts me. Now 1st scanf and printf shoudnt the output be "ckers" instead of Hackers . But in the fourth scanf it should take "us" as the input and 's' should be the output . Similarly for the fifth scanf it takes 'on' as the input but it gives something called as '-' as output.

insert
Code:
#include <stdio.h>
#include <conio.h>

void main(){

	printf("Enter the string");

	scanf("\n\r%s", &s[2]);
	printf("\n\r %s", &s[2]);

	scanf("\n\r%s", s);
	printf("\n\r%s", s);
	
	scanf("\n%s", &s);
	printf("\n%s", &s);
	
	scanf("\n%c", &s[1]);
	printf("\n%c", &s[1]);
	
	scanf("\n%c", &s);
	printf("\n%c", &s);
}