View Code of Problem 55

#include<stdio.h>
#include <string.h>
#define N 100
int main() {
	char a[N];
	char b;
	int i,j,k=0,n;
	gets(a);
	scanf_s("%c", &b);
	n = strlen(a);
	for (i = 0; i < n; i++) {
		if (b != a[i]) {
			printf("%c", a[i]);
		}
	}
}
/*
Main.c: In function 'main':
Main.c:8:2: warning: 'gets' is deprecated [-Wdeprecated-declarations]
  gets(a);
  ^~~~
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:9:2: warning: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
  scanf_s("%c", &b);
  ^~~~~~~
  scanf
Main.c:7:10: warning: unused variable 'k' [-Wunused-variable]
  int i,j,k=0,n;
          ^
Main.c:7:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j,k=0,n;
        ^
/usr/bin/ld: /tmp/ccsX8VZ8.o: in function `main':
Main.c:(.text.startup+0x12): warning: the `gets' function is dangerous and should not be used.
/usr/bin/ld: Main.c:(.text.startup+0x25): undefined reference to `scanf_s'
collect2: error: ld returned 1 exit status
*/

Double click to view unformatted code.


Back to problem 55