in Programming in C edited by
478 views
0 votes
0 votes
int main(int argc, char *argv[]) {
    
    int valid = 0;
    char str1[8] = "start";
    char str2[8];
    gets(str2);
    if (strncmp(str1, str2, 8) == 0) valid = 1;
    printf("buffer1: str1(%s), str2(%s), valid(%d)\n", str1, str2, valid);

}

in Programming in C edited by
478 views

4 Comments

Did you mean, There should be no gap between Valid variable and str1[4-7]?
0
0
i am asking why is there a space ?
0
0
space means ?
0
0
Note that, when some variable declared by user, it can stored in a free space, not necessarily contiguous to previous variable allocated space.
0
0

Please log in or register to answer this question.