Reputation: 1
so I started programming in c on visual studio. (i must use vs)
while my instructer can use scanf on vs, i cant (must use scanf_s).
can anyone tell me why? or what other diffrences could be?
another thing is that my instructer ran this (below) code fine, but my computer compile it good but the output is messed up.
#include <stdio.h>
void main()
{
int x, y;
char z;
printf("put expression");
scanf_s("%d%c%d", &x, &z, &y);
printf("%d%c%d", x, z, y);
}
*if i only scan int and a char (without the last int) it works fine. (scanf_s("%d%c"))
why dose my vs act diffrent that my instructer vs? (same code)
how can i fix it? and if i cant how can i know what other diffrences we might have?
thank you guys and have a good weekend!
Upvotes: 0
Views: 970
Reputation: 13
You should use _CRT_SECURE_NO_WARNINGS go to project projectname properties c/c++ preprocessor you should see preprocessor definition add it there
Upvotes: 1