int main(void)
{
int x;
("x: ");
printf("%i", &x);
scanf("x: %i\n", x);
printf}
Non-functional:
int main(void)
{
char *s;
("s: ");
printf("%s", s);
scanf("s: %s", s);
printf}
"s: null"
because char *s
needs dynamic memory allocation while int x
has a fixed space in memory.Possible fixes:
memalloc(n)
, but then you run the risk of segfaulting on a large input.