| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 
 |  
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include "conio.h"
int main(void)
{
  //Exemple with good functions
  char str[256], str2[256];
  puts("Exemple with good functions");
  puts("str =");
  fgets(str, sizeof str, stdin);
  puts("str2=");
  fgets(str2, sizeof str2, stdin);
  if(strcmp (str, str2) == 0)
           puts("str = str2");
  else
           puts("str != str2");
  getch();
  clrscr();
  //Exemple with bad functions
  puts("Exemple with bad functions");
  printf("str=");
  scanf("%s", &str);
  printf("str2=");
  scanf("%s", &str2);
  if(strcmp (str, str2) == 0)
           puts("str = str2");
  else
           puts("str != str2");
  getch();
  return 0;
} | 
Partager