sami sam

sami sam

  • NA
  • 40
  • 29.4k

what is almost correct (C Progamming )

Aug 19 2012 5:47 AM
Hi,

My teacher told me that we do not need [80] in --->  while (c1[80]!=c2[80]) {

And she said it has to be [0]
I am not sure if we also need value of 0 in ---> char c1[80], c2[80];
It is regards to my assignment and important of not losing marks on some rubbish mistakes
___________________


#include <stdio.h>
#include <string.h>
char c1[80], c2[80];
int main() {
    printf("Please enter card type:\n");
    gets(c1);                                                                                                                                       
    gets(c2); 
    while (c1[80]!=c2[80]) {
       strcpy(c1,c2);
        gets(c2);
    }
        printf("SNAP");
}

Answers (1)