is this what you want?

Code:
#include <stdio.h>
#include <string.h>

int main(){
char data[10];
char temp[4];
char message[]="Correct Password";
printf("\ngive me data:");
scanf("%s",&data);
if (strcmp(data,"Virtual")==0){
    printf("%s",message);
}else{
    strncpy(temp,message,4);
    temp[4]='\0';
    printf("%s",temp);
    printf("\nlength=%d",strlen(message));
}

getchar();getchar();
return 0;
}
Fatima Khan like this