My program is giving different output on different machines..!

Viewed 924
#include<iostream>
#include<string.h>
#include<stdio.h>


int main()
{
    char left[4];
    for(int i=0; i<4; i++)
    {
        left[i]='0';
    }
    char str[10];
    gets(str);
    strcat(left,str);
    puts(left);
    return 0;
}

for any input it should concatenate 0000 with that string, but on one pc it's showing a diamond sign between "0000" and the input string...!

5 Answers
Related